Kling Video Generation
Use `POST /v1/videos` to submit Kling async video tasks, covering text-to-video, image-to-video, multiple reference images, first-and-last-frame, motion control, digital avatar, lip sync, and advanced ExtInfo passthrough.
https://zx1.deepwl.net/v1/videoscurl -X POST https://zx1.deepwl.net/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"model": "Kling-3.0-Omni",
"prompt": "Cyberpunk city night scene, the camera slowly pushes in",
"seconds": "5",
"metadata": {
"output_config": {
"resolution": "720P",
"aspect_ratio": "16:9"
}
}
}'{
"id": "video_123",
"task_id": "video_123",
"object": "video",
"model": "kling-3.0-omni-720p-ref-audio",
"status": "queued",
"progress": 0,
"created_at": 1712697600
}Kling uses POST /v1/videos to submit asynchronous video tasks in JSON. It supports text-to-video, image-to-video, multiple reference images, first-and-last-frame video, motion control, digital avatars, lip sync, and more. Extended parameters (output config, scene type, reference video, etc.) are passed through the metadata field. After a successful submission, the task id and status are returned; poll for results via Task Status Query.
Supported Models
Pass a base model name in the model field:
| Base Model | Duration Options (seconds) | Description |
|---|---|---|
Kling-3.0-Omni | 5, 10, 15 | Kling 3.0 all-in-one; long-video examples use 15 seconds |
Kling-3.0 | 5, 10 | Kling 3.0; advanced params such as multi-shot go through ext_info |
Kling-2.6 | 5, 10 | Kling 2.6; motion control supports motion_level: std/pro |
Kling-2.5 | 5, 10 | Kling 2.5 |
Kling-2.1 | 5, 10 | Kling 2.1 (version used in the digital avatar / lip sync examples) |
Kling-2.0 | 5, 10 | Kling 2.0 |
Kling-1.6 | 5, 10 | Kling 1.6 |
Kling-O1 | 5, 10 | Kling O1 |
Per the gateway spec: the Kling duration tiers are 5 / 10 (default 5); Kling-3.0-Omni additionally supports a 15-second vertical long video (see request examples). Kling-O3 and Kling-Mini are not yet preset in the docs and billing mapping.
Composite billing model names (can be passed directly as model; the gateway restores the upstream ModelName/ModelVersion and fills in the parameters):
kling-3.0-omni-1080p-ref-audio: 3.0-Omni · 1080P ·ref=with reference input (noref=no reference) ·audio=with sound (mute=silent)kling-2.6-motion-pro-1080p: 2.6 motion control · tierpro(std/pro) · 1080Pkling-avatar-720p: digital avatar scene · 720Pkling-identify-face: lip sync scene (billed at 5 seconds if shorter)
Request Headers
Authorizationstring必填Authentication header. Uses a Bearer token, e.g. Bearer YOUR_API_KEY.
Content-Typestring必填Request content type, must be application/json.
Request Body
modelstring必填Model name. Pass a base model such as Kling-3.0-Omni or Kling-2.6, or a composite billing model name such as kling-3.0-omni-1080p-ref-audio.
promptstringPrompt. Describes the video content to generate; supports both Chinese and English, and works together with the input image/video.
secondsstring | integer默认值: 5Video duration in seconds. Top-level field with the highest priority. Values follow the model tiers: 5 / 10 for the Kling series, 15 for Kling-3.0-Omni (keep it consistent with metadata.output_config.duration).
durationstring | integerCompatibility alias for seconds; effective only when top-level seconds is absent.
sizestringQuick size input: 720P / 1080P, or a WxH shortcut (e.g. 720x1280, 1792x1024). The gateway derives resolution and aspect_ratio from it (e.g. 720x1280 → 720P + 9:16). For complex scenes, pass metadata.output_config.resolution / aspect_ratio explicitly to avoid ambiguous aspect-ratio behavior.
imagestringSingle reference or first-frame image. Accepts an accessible http(s) image URL or a file ID. data:image/...;base64,... is not supported.
imagesarray<string>Multiple reference images, up to 3. Each item is an http(s) image URL or a file ID; the gateway converts them to FileInfos (Type=Url, Category=Image).
metadataobjectMetadata. Container for extended parameters; it is recommended to place all upstream native parameters in metadata.
output_configobjectOutput configuration, mapped to the upstream AigcVideoOutputConfig; snake_case keys are auto-mapped. Full field list below (fields marked Vidu do not apply to Kling):
| Field | Type | Values & Description |
|---|---|---|
resolution | String | 720P / 1080P, default 720P |
aspect_ratio | String | Text-to-video supports 16:9 / 9:16 / 1:1, default 16:9 |
duration | Float | Generation duration (seconds); Kling supports 5 / 10 |
audio_generation | String | Enabled / Disabled, controls sound on/off |
person_generation | String | AllowAdult / Disallowed |
input_compliance_check | String | Enabled / Disabled |
output_compliance_check | String | Enabled / Disabled |
enhance_switch | String | Enabled / Disabled |
storage_mode | String | Permanent / Temporary, default Temporary |
media_name | String | Output media name, max 64 characters |
class_id | Integer | Class ID, default 0 |
expire_time | String | Expiration time, ISO 8601 (e.g. 2025-12-28T00:35:00Z) |
frame_interpolate | String | Enabled / Disabled (Vidu) |
logo_add | String | Enabled / Disabled (Vidu) |
scene_typestringScene type:
motion_control: motion control (Kling, a video reference is required)avatar_i2v: digital avatar (Kling)lip_sync: lip sync (Kling, billed at 5 seconds if shorter)template_effect: template effects (Vidu scene)
motion_levelstringMotion control tier (gateway extension field): std (standard), pro (professional). Used for motion-control billing tiers together with scene_type=motion_control.
offpeakbooleanWhether to use off-peak billing. true: generate the video during off-peak hours (lower cost); false: generate immediately.
last_frame_urlstringThe last frame in first-and-last-frame generation. Provide the tail-frame image URL (use the top-level image for the first frame).
last_frame_file_idstringFile ID of the last frame; alternative to last_frame_url.
video_urlstringReference video URL (gateway extension field, auto-converted to FileInfos). Required when scene_type=motion_control.
file_infosarray<object>Native FileInfos passthrough (advanced usage), up to 3 items. Sub-fields below (example JSON uses lowercase keys; both casings are accepted):
| Sub-field | Type | Description |
|---|---|---|
Type | String | File / Url |
Category | String | Image / Video |
FileId | String | Used when Type=File |
Url | String | Used when Type=Url |
Usage | String | e.g. FirstFrame / Reference |
ReferenceType | String | Applies to Kling: when Category=Video, distinguishes reference video types — feature=feature reference video, base=video to edit |
KeepOriginalSound | Boolean | Effective when Category=Video |
ObjectId | String | Vidu subject / reference-image mode |
VoiceId | String | Applies to Vidu-q2 |
ext_infostringNative ExtInfo string passthrough (advanced usage). Must be a string, not an object. Suited for Kling 3.0 multi-shot and other extended params not yet split into output_config. If the upstream AdditionalParameters also requires a string, double-encode it as a JSON string per the official format. Use the official field name shot_type — not short_type.
Parameter Rules
- Duration priority: top-level
seconds> top-levelduration>metadata.seconds/metadata.duration/metadata.video_duration> default5 - Resolution priority:
metadata.output_config.resolution> top-levelsize> model default720P - Default aspect ratio for text-to-video is
16:9;sizeshortcuts:720x1280→720P+9:16,1792x1024→1080P+7:4 scene_type=motion_controlrequires a video reference (metadata.video_urlor afile_infosentry withCategory=Video); an image-only request fails withvideoUrl must not be blankfile_infosis limited to 3 items;Type=Urlmust includeUrl,Type=Filemust includeFileId- Top-level
image/imagesdo not support base64 data URIs scene_type=lip_syncis billed at 5 seconds when shorter than 5 seconds- In a real request,
ext_infomust be a JSON string: first build theAdditionalParametersobject, serialize it to a string, then submit it as theExtInfostring (double encoding). The examples below show its structure as a readable object
Request Examples
Complete call examples for each scenario; switch between them via the tabs. In the ExtInfo Multi-shot and ExtInfo + Motion Control examples, ext_info is shown as a readable object to make the structure clear — serialize it to a string before submitting, per the rules above.
Response Example
Note: The
modelfield in the response may include a billing-spec suffix (such as720p-ref-audio), which differs from the model name passed in the request.
Response Fields
idstringTask ID.
task_idstringTask ID (same as id).
objectstringFixed to video.
modelstringModel name (may carry a billing-spec suffix, see the response example note).
statusstringTask status. Common values include queued, processing, completed, failed, and cancelled.
progressintegerProgress percentage (0-100).
created_atintegerCreation time (Unix timestamp).