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. When using Omni All-Purpose Reference (model `kling-o1` or `kling-v3-omni`), you need to reference the corresponding numbers (starting from 1) in `image_list` / `video_list` in the form of `<<<image_1>>>`, `<<<video_1>>>` in the prompts for the model to apply these references; for example, "Change `<<<video_1>>>` to anime style."
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-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_scalenumber
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, measured in seconds, is optional. For kling-v3/kling-v3-omni: supports flexible settings of 3–15 seconds (integer); kling-o1 only supports 5 seconds; other models: enumerated values are 5 or 10. Requests that include tail frames only support 5 seconds.
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
image_listarray
Omni reference image list, applicable only to models `kling-o1` and `kling-v3-omni`. Array elements pass image links through `image_url` (supporting reference images for subjects, scenes, styles, etc.); optional `type` specifies as first frame `first_frame` or last frame `end_frame`, if `type` is not provided, it will be treated as a pure reference image. When using, it must be referenced in the `prompt` in the form of `<<<image_1>>>`, `<<<image_2>>>` for the corresponding numbered images. Image requirements: format .jpg/.jpeg/.png; file size ≤10MB; shortest side ≥300px; aspect ratio 1:2.5 ~ 2.5:1. If there is no reference video, a maximum of 7 reference images; if there is a reference video, a maximum of 4 images. The last frame must be used with the first frame. If both `start_image_url` / `end_image_url` and `image_list` are provided, the first / last frame will be placed before `image_list`, which may affect the corresponding sequence of `<<<image_N>>>`. Omni reference requests do not support `negative_prompt`, `cfg_scale`, or `camera_control`, nor do they support `mode=4k`.
video_listarray
Omni reference video list, applicable only to models `kling-o1` and `kling-v3-omni`. Upload a reference video via `video_url` (format: MP4/MOV; duration: 3–10 seconds; resolution: 720px–2160px; frame rate: 24–60fps; file size ≤200MB). `refer_type` can be set to **feature** (feature reference) or **base** (the base video to be edited, default value); `keep_original_sound` can be set to `yes` or `no`. When in use, it must be referenced in the `prompt` as `<<<video_1>>>`. `refer_type=base` cannot be used simultaneously with the first frame or last frame; when a reference video exists, `generate_audio` must be `false`. Omni reference requests do not support `negative_prompt`, `cfg_scale`, `camera_control`, or `mode=4k`.
camera_controlobject
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].
typestring
Please select
configobject
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

Integration guide
Kind reminder: For streaming requests, the above code may not be fully applicable. Please refer to the integration documentation for changes.
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.