Skip to main content

Kling - Video Generation API documentation

The Kling video generation model supports text-to-video, image-to-video from a first frame, image-to-video from first and last frames, reference-to-video, and video editing .

This document applies only to the China (Beijing) region. Use an API key from this region.

Activate the service

Go to the Alibaba Cloud Model Studio console, search for "kling", locate the Kling AI model card, click Activate Now, and then confirm activation and authorization in the pop-up window.

Model overview

Model name

Capabilities

Input modalities

Output video specs

kling/kling-v3-turbo-video-generation

  • Text-to-video

  • Image-to-video from a first frame

Text, image

Resolution mode: std (720P), pro (1080P)

Aspect ratio: 16:9, 9:16, 1:1

Video duration: 3-15s

Video format: MP4

kling/kling-v3-video-generation

  • Text-to-video

  • Image-to-video from a first frame

  • Image-to-video from first and last frames

Text, image

Resolution mode: std (720P), pro (1080P), 4k

Aspect ratio: 16:9, 9:16, 1:1

Video duration: 3-15s

Video format: MP4

kling/kling-v3-omni-video-generation

  • Text-to-video

  • Image-to-video from a first frame

  • Image-to-video from first and last frames

  • Reference-to-video

  • Video editing

Text, image, video

Resolution mode: std (720P), pro (1080P), 4k

Aspect ratio: 16:9, 9:16, 1:1

Video duration: 3-15s

Video format: MP4

Scope

To ensure successful calls, make sure that the model, Endpoint URL, and API Key all belong to the same region. Cross-region calls will fail.
  • Select a model: Confirm the region to which the model belongs.
  • Select a URL: Select the corresponding regional Endpoint URL. HTTP URLs are supported.
  • Configure an API Key: Select a region and obtain an API key. Then, configure the API key as an environment variable (to be deprecated and merged into API key configuration).

HTTP invocation

Video generation tasks take a long time—typically 1 to 5 minutes—so the API uses asynchronous invocation. The process involves two main steps: Create a task → Poll for the result. The steps are as follows:

Step 1: Create a task and get the task ID

Beijing region: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis Replace {WorkspaceId} with your actual workspace ID.
  • After the task is created, use the returned task_id to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result.
  • For guidance for beginners, see Call APIs with Postman or cURL.

Request parameters

Headers
Content-Type string (Required)The content type of the request. Must be application/json.Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.X-DashScope-Async string (Required)Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be enable.
If this request header is missing, the error "current user api does not support synchronous calls" is returned.
Request Body
model string (Required)The model name.Valid values:
  • kling/kling-v3-turbo-video-generation
  • kling/kling-v3-video-generation
  • kling/kling-v3-omni-video-generation
input object (Required)Basic input information, such as prompts and media assets.

Properties

prompt string (Conditionally required)The text prompt describes the desired elements and visual features in the generated video.Chinese and English are supported. Each Chinese character or letter counts as one character. The maximum length is 2,500 characters. Exceeding the limit will result in an error.Logic:
  • When shot_type=intelligence, this parameter is required.
  • When shot_type=customize, this parameter is ignored. Use multi_prompt instead.
The Omni model can use the prompt with entities, images, and videos to achieve various capabilities:
  • Supported model: kling/kling-v3-omni-video-generation.
  • Applicable task: reference-to-video.
  • Reference format: Use the <<<>>> format to specify an entity, image, or video, such as <<<element_1>>>, <<<image_1>>>, or <<<video_1>>>.
  • Reference order: Define the reference order in the prompt according to the order in the media array.
  • Example: A <<<element_1>>> runs under the moonlight.
negative_prompt string (Optional)The negative prompt describes what you do not want to appear in the result. Maximum 2,500 characters.
  • kling/kling-v3-turbo-video-generation does not support a separate negative prompt. This field has no effect (include negative descriptions in prompt instead).
  • Supported models: kling/kling-v3-video-generation and kling/kling-v3-omni-video-generation.
media array (Optional)You do not need to specify this parameter for text-to-video tasks.A list of media assets used to specify image or video materials.Different models support different combinations of media assets:

Asset combination rules

kling/kling-v3-turbo-video-generation

Only the following media asset combinations are supported. Invalid combinations will cause an error.
  • Image-to-video from a first frame: first_frame.
    • Quantity limit: Exactly 1 first frame. last_frame is not supported.

kling/kling-v3-video-generation

Only the following media asset combinations are supported. Invalid combinations will cause an error.
  • Image-to-video from a first frame: first_frame.
    • Quantity limit: 1 first frame.
  • Image-to-video from first and last frames: first_frame+last_frame.
    • Quantity limit: 1 first frame and 1 last frame.

kling/kling-v3-omni-video-generation

Only the following media asset combinations are supported. Invalid combinations will cause an error.
  • Image-to-video from a first frame: first_frame.
    • Image quantity: 1 first frame.
  • Image-to-video from first and last frames: first_frame+last_frame.
    • Image quantity: 1 first frame and 1 last frame.
  • Reference-to-video: The following media combinations are supported.
    • If only feature is passed: 1 video must be passed.
    • If only refer is passed: The sum of reference images and multi-image entities (the length of the element_list array) cannot exceed 7.
    • If feature+refer is passed: 1 video must be passed, and the sum of reference images and multi-image entities (the length of the element_list array) cannot exceed 4.
    • If feature+first_frame is passed: 1 video and 1 first frame must be passed.
  • Video editing: The following media combinations are supported.
    • If only base is passed: 1 video must be passed.
    • If base+refer is passed: 1 video must be passed, and the sum of reference images and multi-image entities (the length of the element_list array) cannot exceed 4.

Properties

type string (Required)The type of media asset. The valid values depend on the selected model:

kling/kling-v3-turbo-video-generation

Valid values:
  • first_frame: The first frame image.
last_frame is not supported. For restrictions on combinations of different media assets, see "Asset combination rules" under the media parameter.

kling/kling-v3-video-generation

Valid values:
  • first_frame: The first frame image.
  • last_frame: The last frame image.
For restrictions on combinations of different media assets, see "Asset combination rules" under the media parameter.

kling/kling-v3-omni-video-generation

Valid values:
  • first_frame: The first frame image.
  • last_frame: The last frame image.
  • refer: The reference image.
  • base: The video to be edited.
  • feature: The feature reference video.
For restrictions on combinations of different media assets, see "Asset combination rules" under the media parameter.
url string (Required)The URL of the media asset. Assets include images and videos.

Pass an image (type=first_frame, last_frame, or refer)

The image URL.Image restrictions:
  • Format: JPEG, JPG, or PNG (alpha channels are not supported).
  • Resolution: The width and height must be between 300 and 8000 pixels.
  • Aspect ratio: Between 1:2.5 and 2.5:1.
  • File size: No more than 10 MB.

Pass a video (type=base or feature)

The URL of the video file.Video restrictions:
  • Format: MP4 or MOV.
  • File size: No more than 200 MB.
  • Duration: 3 to 15.5 seconds.
  • Resolution: Width and height must be between 700 and 4553 pixels. Total pixel area cannot exceed 8,294,400.
  • Aspect ratio: Between 0.4 and 2.
  • Frame rate: 24 to 60 fps.
keep_original_sound string (Optional)Supported model: kling/kling-v3-omni-video-generation.Effective condition: This parameter takes effect only when a video is passed (type=base or feature).Specifies whether to keep the original video's sound.
  • no: Default value. The original sound is not kept.
  • yes: The original sound is kept.
multi_shot boolean (Optional)Specifies whether to enable multi-shot generation.
  • false: Default value. Multi-shot generation is disabled.
  • true: Multi-shot generation is enabled.
Notes:
  • Video feature reference (feature) scenarios support multi-shot (shot_type only supports intelligence).
  • Video editing (base) scenarios do not support multi-shot.
shot_type string (Conditionally required)Required when multi_shot=true. The type of multi-shot mode.
  • intelligence: Intelligent shot division. The model automatically plans the shots.
  • customize: Custom mode. You can customize the prompt and duration for each segment.
multi_prompt array (Conditionally required)Required when shot_type=customize. A list of segments for the custom multi-shot mode.

Properties

index integer (Required)The index of the shot segment. The number of shots can be from 1 to 6. The index starts from 1.prompt string (Required)The prompt for the corresponding segment. Chinese and English are supported. The maximum length is 512 characters. Excess characters are automatically truncated.duration integer (Required)The duration of the corresponding segment, in seconds.The value must be an integer between 1 and parameters.duration.
element_list array (Optional)A list of entities to be included in the video.Note: kling/kling-v3-turbo-video-generation does not support entities. Do not pass this field.

Properties

element_id integer (Conditionally required)Required when passing element_list. It represents the entity ID. Retrieve the entity ID from the Kling - Entity ID List.Entity count limit (element_list array length limit):
  • Image-to-video from a first frame: Supports up to 3 entities.
  • Image-to-video from first and last frames: Supports up to 3 entities.
  • Reference-to-video (type=refer): The sum of reference images and multi-image entities cannot exceed 7.
  • Reference-to-video (type=feature+refer): The sum of reference images and multi-image entities cannot exceed 4.
  • Video input scenario (omni model): Supports video-type entities, up to 1. After referencing a video-type entity, you cannot pass reference images or image-type entities.
parameters object (Optional)Video generation parameters. You can set the generation mode, aspect ratio, video duration, and whether to generate audio.

Properties

mode string (Optional)The video generation mode.
  • pro: Default value. Professional mode. The output video resolution is 1080p.
  • std: Standard mode. The output video resolution is 720p.
  • 4k: 4K mode. The output video resolution is 4K.
Note: kling/kling-v3-turbo-video-generation only supports std (720P) and pro (1080P). 4K is not supported.aspect_ratio string (Conditionally required)The aspect ratio of the generated video.Valid values:
  • 16:9: Default value.
  • 9:16
  • 1:1
This must be specified in the following scenarios:
  • Text-to-video: Must be set.
  • Reference-to-video (type=feature, type=feature+refer, type=refer): Must be set.
  • Image-to-video from a first frame: The aspect ratio of the first frame is used. You do not need to specify this.
  • Image-to-video from first and last frames: The aspect ratio of the first frame is used. You do not need to specify this.
  • Reference-to-video (type=feature+first_frame): The aspect ratio of the first frame is used. You do not need to specify this.
  • Video editing: The aspect ratio of the input video is used. You do not need to specify this.
duration integer (Optional)
The duration directly affects the cost. Billing is based on seconds. The longer the duration, the higher the cost. Go to the Model Studio console to view prices.
The duration of the generated video, in seconds.
  • kling/kling-v3-turbo-video-generation: The value must be an integer between 3 and 15. The default value is 5.
  • kling/kling-v3-video-generation: The value must be an integer between 3 and 15. The default value is 5.
  • kling/kling-v3-omni-video-generation: The value must be an integer between 3 and 15. The default value is 5.
    • Note: When a reference video is passed, the behavior of this parameter varies depending on the type:
      • type=feature: The value must be an integer between 3 and 10. The default value is 5.
      • type=base: The output video duration is the same as the input video duration. This parameter is ignored. Billing is based on the input video duration, rounded to the nearest integer.
Example: 5.audio boolean (Optional)
Audio directly affects the cost. Go to the Model Studio console to view prices.
Specifies whether to generate a video with sound. If enabled, the model automatically generates matching background music or sound effects based on the video content.
  • false: Default value. A silent video is output.
  • true: A video with sound is output.
Notes:
  • When a video is passed in (type=base or feature), audio can only be set to false.
  • kling/kling-v3-turbo-video-generation always generates video with audio. This field has no effect (audio is always generated).
watermark boolean (Optional)Specifies whether to simultaneously generate a watermarked version of the video. The watermark is located in the lower-right corner and displays "Kling AI". When set to true, the response will additionally return the watermark_video_url field.
  • false: Default value. No watermarked video is generated.
  • true: A watermarked video is generated simultaneously.
  • Text-to-video
  • Python SDK
  • Text-to-video (custom shot division)
  • Image-to-video (from a first frame)
  • Image-to-video (from first and last frames)
  • Video editing
Supported models: kling/kling-v3-turbo-video-generation, kling/kling-v3-video-generation, and kling/kling-v3-omni-video-generation.
# The URL below is for the China (Beijing) region. Replace {WorkspaceId} with your actual workspace ID.
curl --location 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "kling/kling-v3-turbo-video-generation",
    "input": {
        "prompt": "A kitten runs under the moonlight"
    },
    "parameters": {
        "mode": "std",
        "aspect_ratio": "16:9",
        "duration": 5,
        "audio": false,
        "watermark": true
    }
}'

Response parameters

output objectTask output information.

Properties

task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
request_id stringUnique request identifier for tracing and troubleshooting.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.
  • Successful response
  • Error response
Save the task_id to query the task status and result.
{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Step 2: Query the result by task ID

Beijing region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}
  • Polling recommendation: Video generation takes several minutes. Use a polling mechanism with a reasonable query interval (such as 15 seconds) to retrieve the result.
  • Task status flow: PENDING (In queue) → RUNNING (Processing) → SUCCEEDED (Successful) / FAILED (Failed).
  • task_id validity: 24 hours. After this period, you cannot query the result, and the API returns the task status as UNKNOWN.
  • RPS limit: The default records per second (RPS) for the query API is 20. For higher-frequency queries or event notifications, configure an asynchronous task callback.
  • More operations: To perform operations such as batch queries or canceling tasks, see Manage asynchronous tasks.

Request parameters

Headers
Authorization string (Required)Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.
URL path parameters
task_id string (Required)The ID of the task.
  • Query task result
Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours, Replace {WorkspaceId} with your actual workspace ID.
curl -X GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

output objectTask output information.

Properties

task_id stringThe task ID. Valid for queries for 24 hours.task_status stringThe status of the task.

Enumeration values

  • PENDING
  • RUNNING
  • SUCCEEDED
  • FAILED
  • CANCELED
  • UNKNOWN: The task does not exist or its status is unknown.
State transitions during polling:
  • PENDING → RUNNING → SUCCEEDED or FAILED.
  • The initial query status is usually PENDING or RUNNING.
  • When the status changes to SUCCEEDED, the response contains the generated video URL.
  • If the status is FAILED, check the error message and retry the task.
submit_time stringThe time when the task was submitted. format is YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringThe time when the task was executed. format is YYYY-MM-DD HH:mm:ss.SSS.end_time stringThe time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.video_url stringThe video URL. This is returned only when task_status is SUCCEEDED.The video is in MP4 format (H.264 encoding). The video link is valid for 30 days, but do not rely on it for long-term storage. Download the video promptly.watermark_video_url stringThe URL of the video with a watermark. This is returned only when task_status is SUCCEEDED.The video is in MP4 format (H.264 encoding). The video link is valid for 30 days, but do not rely on it for long-term storage. Download the video promptly.orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.code stringError code. Returned only for failed requests. See Error codes.message stringDetailed error message. Returned only for failed requests. See Error codes.
usage objectStatistics for the output information. Only successful results are counted.

Properties

duration integerThe total duration of the generated video, used for billing.size stringThe resolution of the generated video. Example: 1280×720.fps integerThe frame rate of the generated video. Example: 24.SR stringThe resolution tier of the generated video. Example: 720.audio booleanIndicates whether the generated video has sound. Example: false.video_count integerThe number of generated videos. This is fixed at 1.
request_id stringUnique request identifier for tracing and troubleshooting.
  • Task successful
  • Task failed
  • Task query expired
{
    "request_id": "340f0d7d-bf7e-4c8f-9c03-xxxxxx",
    "output": {
        "task_id": "24f5c51e-d67b-44dc-9acb-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-03-27 21:30:32.575",
        "scheduled_time": "2026-03-27 21:30:32.603",
        "end_time": "2026-03-27 21:31:09.177",
        "video_url": "https://v4-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx",
        "watermark_video_url": "https://v2-fdl.kechuangai.com/ksc2/xxx.mp4?xxxx"
    },
    "usage": {
        "duration": 5,
        "size": "1280*720",
        "fps": 24,
        "video_count": 1,
        "audio": false,
        "SR": "720"
    }
}

Error codes

If the model call fails and returns an error message, see Error codes for resolution.
Text Generation
Image Generation
Video Generation
World models
3D Model Generation
Audio
  • Audio generation
Realtime API
Text Embedding
Decision Model
TokenPlan
Model Production