Kling Videos Generation API
POSThttps://api.acedata.cloud/kling/videos
This API can generate videos by inputting prompt words and the first and last frame images.
Related Products
Kling - Ace Data Cloud
Kling video generation platform, directly interfaces with this API, high-speed and stable availability.
Request Headers
acceptstring
The format of the server response should be set to application/json.
Please select
authorizationstring
Bearer token
Request Body
actionstringRequired parameter
Video generation action. If the value is `text2video`, then generate a video based on the prompt.
modelstring
The model used for generating videos, with a default value of kling-v1.
Please select
promptstring
Prompts for generating videos.
start_image_urlstring
You can specify the first frame reference image of the video, which is effective when the action is image2video.
end_image_urlstring
End frame reference image URL. Valid only when `action=image2video` and `start_image_url` is not empty. Model/mode restrictions (consistent with Kling official documentation): `kling-v1` requires `duration=5`; `kling-v1-6`/`kling-v2-5-turbo`/`kling-v2-6` require `mode=pro`; `kling-v3`/`kling-v3-omni`/`kling-video-o1` support end frames in all modes; `kling-v2-master`/`kling-v2-1-master` do not support end frames.
video_idstring
When the action is extend, you can specify the video_id to continue the extension of that video.
cfg_scalestring
The strength of relevance of the prompt words, used to control the degree of alignment between the generated video and the prompt words, is optional. The larger the value, the stronger the association between the video and the prompt words (the creative space is smaller); the smaller the value, the higher the degree of creative freedom. The range of values is: [0, 1].
negative_promptstring
Optional parameters, supporting up to 200 characters, used to describe content that you do not wish to appear in the video.
modestring
Video generation mode, optional. Supported values: `std` (high performance mode), `pro` (high quality mode), `4k` (native 4K, only supported by `kling-v3` and `kling-v3-omni`, incompatible with "motion control"). The default value is `std`.
Please select
aspect_ratiostring
Video aspect ratio, optional, enumeration values: 16:9, 9:16, 1:1. The default value is 16:9.
Please select
durationnumber
Video generation duration, in seconds, is optional. For kling-v3/kling-v3-omni: supports flexible settings of 3–15 seconds (integer); other models: enumerated values are 5 or 10. Requests that include tail frames only support 5 seconds.
Please select
generate_audioboolean
Whether to generate audio while generating video, optional. Only `kling-v3`, `kling-v3-omni`, and `kling-v2-6` (pro mode only) support this parameter; other models will return an error if this value is set to true. The default value is false.
Please select
video_listarray
Used to upload a reference video via `video_url` (format: MP4/MOV; duration: 3–10 seconds; resolution: 720px–2160px; frame rate: 24–60fps; file size ≤200MB; up to 1 video). The `refer_type` can be set to **feature** (feature reference video) or **base** (the base video to be edited, default value); a video set to **base** cannot define the first or last frame. You can choose whether to keep the original audio through `keep_original_sound` (`yes` to keep, `no` to remove, applicable to both types). `video_url` cannot be empty.
element_listarray
Used to specify a list of reference subjects when generating content, configured through the `element_id` in the `element_list` array (ID in the subject library). The number of reference subjects must be combined with the number of reference images and adhere to the following restrictions: **If there are reference videos, reference subjects + reference images ≤ 4**; **If there are no reference videos, reference subjects + reference images ≤ 7**.
camera_controlstring
Contains 6 fields used to specify the movement or change of the camera in different directions. `camera_control.type` must be one of the following values: `simple`, `down_back`, `forward_up`, `left_turn_forward`, `right_turn_forward`. `camera_control.config` is an optional object that contains 6 optional fields: `camera_control.config.horizontal` (horizontal translation), `camera_control.config.vertical` (vertical translation), `camera_control.config.pan` (horizontal rotation), `camera_control.config.tilt` (pitch rotation), `camera_control.config.roll` (axial rotation), `camera_control.config.zoom` (zoom). The value of each field is of numeric type, with a range of [-1, 1].
callback_urlstring
The callback URL that will be called after the video generation is complete.
asyncboolean
Whether to process in asynchronous mode. When set to `true`, the interface immediately returns `task_id`, without the need to provide `callback_url`, and then the result can be obtained by polling the corresponding task query interface; if `callback_url` is also provided, the result will be pushed to that callback address.
Please select
Response
Kling video generation
Allow Use General Balance
When 'Allow General Balance' is enabled, the general balance is used automatically if an app's balance is insufficient.
Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.
