OpenAI Format

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.

POSThttps://zx1.deepwl.net/v1/videos
Request
curl -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"
    }
  }
}'
Response
{
  "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 ModelDuration Options (seconds)Description
Kling-3.0-Omni5, 10, 15Kling 3.0 all-in-one; long-video examples use 15 seconds
Kling-3.05, 10Kling 3.0; advanced params such as multi-shot go through ext_info
Kling-2.65, 10Kling 2.6; motion control supports motion_level: std/pro
Kling-2.55, 10Kling 2.5
Kling-2.15, 10Kling 2.1 (version used in the digital avatar / lip sync examples)
Kling-2.05, 10Kling 2.0
Kling-1.65, 10Kling 1.6
Kling-O15, 10Kling 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 · tier pro (std/pro) · 1080P
  • kling-avatar-720p: digital avatar scene · 720P
  • kling-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.

promptstring

Prompt. Describes the video content to generate; supports both Chinese and English, and works together with the input image/video.

secondsstring | integer默认值: 5

Video 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 | integer

Compatibility alias for seconds; effective only when top-level seconds is absent.

sizestring

Quick 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.

imagestring

Single 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).

metadataobject

Metadata. Container for extended parameters; it is recommended to place all upstream native parameters in metadata.

output_configobject

Output configuration, mapped to the upstream AigcVideoOutputConfig; snake_case keys are auto-mapped. Full field list below (fields marked Vidu do not apply to Kling):

FieldTypeValues & Description
resolutionString720P / 1080P, default 720P
aspect_ratioStringText-to-video supports 16:9 / 9:16 / 1:1, default 16:9
durationFloatGeneration duration (seconds); Kling supports 5 / 10
audio_generationStringEnabled / Disabled, controls sound on/off
person_generationStringAllowAdult / Disallowed
input_compliance_checkStringEnabled / Disabled
output_compliance_checkStringEnabled / Disabled
enhance_switchStringEnabled / Disabled
storage_modeStringPermanent / Temporary, default Temporary
media_nameStringOutput media name, max 64 characters
class_idIntegerClass ID, default 0
expire_timeStringExpiration time, ISO 8601 (e.g. 2025-12-28T00:35:00Z)
frame_interpolateStringEnabled / Disabled (Vidu)
logo_addStringEnabled / Disabled (Vidu)
scene_typestring

Scene 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_levelstring

Motion control tier (gateway extension field): std (standard), pro (professional). Used for motion-control billing tiers together with scene_type=motion_control.

offpeakboolean

Whether to use off-peak billing. true: generate the video during off-peak hours (lower cost); false: generate immediately.

last_frame_urlstring

The 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_idstring

File ID of the last frame; alternative to last_frame_url.

video_urlstring

Reference 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-fieldTypeDescription
TypeStringFile / Url
CategoryStringImage / Video
FileIdStringUsed when Type=File
UrlStringUsed when Type=Url
UsageStringe.g. FirstFrame / Reference
ReferenceTypeStringApplies to Kling: when Category=Video, distinguishes reference video types — feature=feature reference video, base=video to edit
KeepOriginalSoundBooleanEffective when Category=Video
ObjectIdStringVidu subject / reference-image mode
VoiceIdStringApplies to Vidu-q2
ext_infostring

Native 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-level duration > metadata.seconds / metadata.duration / metadata.video_duration > default 5
  • Resolution priority: metadata.output_config.resolution > top-level size > model default 720P
  • Default aspect ratio for text-to-video is 16:9; size shortcuts: 720x1280 → 720P + 9:16, 1792x1024 → 1080P + 7:4
  • scene_type=motion_control requires a video reference (metadata.video_url or a file_infos entry with Category=Video); an image-only request fails with videoUrl must not be blank
  • file_infos is limited to 3 items; Type=Url must include Url, Type=File must include FileId
  • Top-level image / images do not support base64 data URIs
  • scene_type=lip_sync is billed at 5 seconds when shorter than 5 seconds
  • In a real request, ext_info must be a JSON string: first build the AdditionalParameters object, serialize it to a string, then submit it as the ExtInfo string (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 model field in the response may include a billing-spec suffix (such as 720p-ref-audio), which differs from the model name passed in the request.

Response Fields

idstring

Task ID.

task_idstring

Task ID (same as id).

objectstring

Fixed to video.

modelstring

Model name (may carry a billing-spec suffix, see the response example note).

statusstring

Task status. Common values include queued, processing, completed, failed, and cancelled.

progressinteger

Progress percentage (0-100).

created_atinteger

Creation time (Unix timestamp).