kling-video-v3 API
Generates 3–15-second video at 720p, 1080p, or 4K from text or first and last frames. It supports existing subjects, optional native audio, and multiple shots.
- Model:
kling-video-v3 - Provider: Kling
- Type: video
POST /v1/videos/generations
Generate video from text or first frame image, supports first/last frames, native audio, and multi-shot views.
Text-to-video
Required parameters: model, prompt
Available parameters: model, prompt, contents, settings, options, wait, nonce, idempotency_key
Request parameters
| Parameter | Type | Required | Description |
|---|
model | string | Yes | Target video model Options: kling-video-v3 |
prompt | string | No | Fill in when using V3/Turbo text-to-video; when using the contents, specify text in type=prompt. |
contents | array | No | Omni is required; required for V3/Turbo image-to-video. Image/video materials and text prompts list follow the field rules described below in parameter details. |
settings | object | No | 3~15 seconds; 720p, 1080p, or 4k. Text-to-video aspect ratios: 16:9, 9:16, and 1:1. |
options | object | No | Optional watermark and external business identifiers |
wait | boolean | No | false: returns task ID immediately after submission; true: returns current task status after a delay |
nonce | string | No | Generate a new nonce upon new generation; in case of exception, reuse the original value |
idempotency_key | string | No | Compatibility field, not used as basis for current video deduplication |
resolution | string | No | compatible field; not added if settings object is present |
first_frame_url | string | No | assembles first frame when no non-empty contents; converts action control to image |
duration | integer | No | compatible output duration; not added if settings object is present |
aspect_ratio | string | No | compatible aspect ratio; only passed in for applicable scenarios |
audio | string | No | compatible audio field; conforms to model and material combination restrictions |
generate_audio | boolean | No | compatible boolean field; does not indicate model support for audio generation |
last_frame_url | string | No | assembles last frame when no contents; must satisfy first and last frame combination constraints |
## Parameter details
The prompt for text-to-video generation is at most 3072 characters, recommended not to exceed 2500; the prompt text in the contents for image-to-video generation is at most 2500 characters.
The request body uses JSON; the dot notation below represents nested fields, for example, `settings.resolution` is written inside the `settings` object.
| Field | Type | Required | Description |
|---|---|---|---|
| `model` | string | Yes | Target video model; optional kling-video-v3 |
| `prompt` | string | No | Fill in when using V3/Turbo text-to-video; when using the contents, specify text in type=prompt. |
| `contents` | array | No | Omni is required; required for V3/Turbo image-to-video. Image/video materials and text prompts list follow the field rules described below in parameter details. |
| `contents[].type` | string | Yes | Selected based on current model and scenario; optional prompt, first_frame, last_frame, element |
| `contents[].text` | string | No | Required when type=prompt |
| `contents[].url` | string | No | Image/video type is required, public HTTPS address |
| `contents[].element_id` | string | No | Required when type=element, valid subject ID already exists |
| `settings` | object | No | 3~15 seconds; 720p, 1080p, or 4k. Text-to-video aspect ratios: 16:9, 9:16, and 1:1. |
| `settings.resolution` | string | No | Output clarity; optional 720p, 1080p, 4k; default is "720p" |
| `settings.duration` | integer | No | Output duration of 3~15 integer seconds; default is 5 |
| `settings.aspect_ratio` | string | No | For text-to-video or Omni scenarios; not passed for image-to-video; optional 16:9, 9:16, 1:1; default is "16:9" |
| `settings.audio` | string | No | Limited by material combination; optional native, off; default is "off" |
| `settings.multi_shot` | boolean | No | Multi-shot; limited by material combination; default is true |
| `options` | object | No | Optional watermark and external business identifiers |
| `options.external_task_id` | string | No | Business identifier; the current site still uses the returned ID for query |
| `options.watermark_info` | object | No | Watermark options |
| `options.watermark_info.enabled` | boolean | No | Enable watermark |
| `wait` | boolean | No | false: returns the task ID immediately after submission; true: returns the current task status after a delay. Default is false |
| `nonce` | string | No | Generate a new nonce upon new generation; in case of exception, reuse the original value |
| `idempotency_key` | string | No | Compatibility field, not used as basis for current video deduplication |
## Query and response
`GET /v1/videos/generations/{id}` queries a single task. `GET /v1/videos/generations?limit=20&offset=0` retrieves the task list, returning `data`, `total`, `limit`, `offset`
pending / submitted / processing indicates in progress; succeeded indicates successful generation; failed / timeout / canceled indicates the task has ended.
| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | No | Original query task ID preserved exactly |
| `model` | string | No | Public model |
| `status` | string | No | Official status; optional values: pending, submitted, processing, succeeded, failed, timeout, canceled, unknown |
| `created_at` | integer | No | Unix timestamp |
| `error` | object | No | Success is typically null; failure may include code and message |
| `error.code` | string | No | Error code |
| `error.message` | string | No | Error message |
| `request_id` | string | No | Request identifier, not the task ID |
| `code` | integer | No | Model result business code |
| `message` | string | No | Result description |
| `data` | array | No | Final model result list; must tolerate and be compatible with object shapes |
| `data[].id` | string | No | Task identifier |
| `data[].status` | string | No | Model result status |
| `data[].message` | string | No | Task description |
| `data[].create_time` | integer | No | Unix milliseconds |
| `data[].update_time` | integer | No | Unix milliseconds |
| `data[].outputs` | array | No | Video result |
| `data[].outputs[].type` | string | No | video |
| `data[].outputs[].id` | string | No | Output identifier, not the query task ID |
| `data[].outputs[].url` | string | No | Temporary video URL, save promptly |
| `data[].outputs[].duration` | string | No | Output duration in seconds, may include decimals; compatible with number type |
| `data[].usage` | object | No | Optional native statistics; absence does not imply 0 |
| `data[].usage.prompt_tokens` | integer | No | Native input tokens; unknown if not provided |
| `data[].usage.input_tokens` | integer | No | Optional native input alias, retain according to actual field |
| `data[].usage.completion_tokens` | integer | No | Native output tokens; no cross-coverage value filling |
| `data[].usage.output_tokens` | integer | No | Optional native output alias, retain according to actual field |
| `data[].usage.total_tokens` | integer | No | Total native count, may differ from official billing total; no additional charges |
| `tokenhub_usage` | object | No | Official billing and reconciliation standard; no overlap with native statistics |
| `tokenhub_usage.total_tokens` | integer | No | Valid non-negative integer, including explicit 0; actual cost uses official total |
| `usage` | object | No | Quota, may be an alias of official quota or native statistics, cannot be billed again |
| `usage.prompt_tokens` | integer | No | Native input tokens; unknown if not provided |
| `usage.input_tokens` | integer | No | Optional native input alias, retain according to actual field |
| `usage.completion_tokens` | integer | No | Native output tokens; no cross-coverage value filling |
| `usage.output_tokens` | integer | No | Optional native output alias, retain according to actual field |
| `usage.total_tokens` | integer | No | Determined by field source, cannot be duplicated with tokenhub_usage |
Top-level `usage.total_tokens` represents the total usage of the task returned, which may include input from reference video; when verifying usage, do not rely solely on output duration. `tokenhub_usage` and `data` contain raw usage details and input/output sub-items only when provided in the response; different metrics are not additive, and absence does not indicate 0. The time, identifiers, media, and token numbers in the example are all fictional data.
## Retries and new tasks
When request results are unclear, first query the original task; if no task ID is obtained, check the task list. For exception recovery, retain the original request content and `nonce`, and do not change the nonce in consecutive POST requests. A new nonce must be generated if a new request is needed. `idempotency_key` is a compatibility field and does not participate in the current video deduplication at this site; it cannot replace the nonce or provide independent idempotency guarantees. After a regular task completes, deduplication mappings may be released, and thus permanent deduplication cannot be guaranteed; requests that have been closed and retained with barriers do not imply they can be regenerated again. Retain the task ID and request ID for verification.
## Common errors
| HTTP status | Processing notes |
|---|---|
| 400 | Parameter, material, billing mode, or current capability not supported |
| 401 | Invalid token |
| 403 | Insufficient permissions |
| 402 | Insufficient available balance or reservation failed |
| 404 | Task not found or unauthorized access |
| 409 | Original submission pending confirmation; nonce not changed |
| 422 | Public Schema or JSON validation failed |
| 429 | Request restricted; verify the original task first |
| 500 | Internal error; recipient status must be verified |
| 502 | Generation service error; recipient status must be verified |
| 503 | Temporarily unavailable. Verify whether the submission was accepted. |
Cancellation is not supported when the task is still in progress. After generation, use the returned HTTPS URL to retrieve the video. The general structure of error responses is shown in the example on the right 400; specific fields are subject to actual return values.
## Image-to-video
Use contents to simultaneously pass prompt and first_frame. Use a public HTTPS address for the image; video aspect ratio follows the image, and aspect_ratio is not provided.
Images must be in JPG/JPEG/PNG format, with a single file up to 50M bytes, minimum width and height of 300 pixels, and aspect ratio of 1:2.5~2.5:1. Only the first frame or first and last frames are used; the last frame alone is not allowed. Turbo mode only uses the first frame. This example uses public HTTPS material URLs.
```json
{
"model": "kling-video-v3",
"contents": [
{
"type": "prompt",
"text": "The paper boat moves slowly forward."
},
{
"type": "first_frame",
"url": "https://media.example.com/first-frame.png"
}
],
"settings": {
"duration": 3,
"resolution": "720p",
"audio": "off"
},
"wait": false
}
```
V3 supports additional last_frame and existing element; Turbo uses prompt and first_frame. V3 audio can be native or off, defaulting to off; multi_shot defaults to true. Turbo does not use audio or multi_shot.
## Official references
[Official API Guide](https://www.tencentcloud.com/zh/document/product/1300/83714) · [International Version Guide](https://intl.cloud.tencent.com/zh/document/product/1300/83714) · [Official Pricing Information](https://www.tencentcloud.com/zh/document/product/1300/78937)
Request example
curl --request POST \
'https://api.router.ai/v1/videos/generations' \
-H "Authorization: Bearer $OPENCROW_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary '{
"model": "kling-video-v3",
"prompt": "A small paper boat floats on a calm lake.",
"settings": {
"duration": 3,
"resolution": "720p",
"audio": "off"
},
"wait": false
}'
Endpoint reference: Aliyun Wan video generation