Text-to-Video
Generate video from a text prompt. Supports multi-shot storytelling, native audio, 720p / 1080p / 4k resolution, and 3–15 second duration. This is an async task-based API: submit a request to receive a task id, poll for status, then download the video when complete. Only Kling 3.0 is supported.
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
Authenticate using a Bearer Token.
Format: Authorization: Bearer sk-xxxxxx
Endpoints
POST /kling/text-to-video/kling-3.0
Create Video Generation Task
Create a video generation task from a text prompt.
Headers
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Content-Type | string | Yes | application/json | Data exchange format |
Authorization | string | Yes | - | Auth header. Format: Bearer sk-xxxxxx |
Request Body
Content-Type: application/json
Example:
{
"prompt": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train.",
"settings": {
"resolution": "4k",
"aspect_ratio": "16:9",
"duration": 15,
"audio": "off",
"multi_shot": true
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": "",
"watermark_info": {
"enabled": false
}
}
}Properties:
| Name | Type | Required | Default | Enum | Description |
|---|---|---|---|---|---|
prompt | string | Yes | - | - | Prompt with positive and negative descriptions |
settings | object | No | - | - | Output configuration such as resolution and duration |
settings.multi_shot | boolean | No | true | - | Whether to generate multi-shot video |
settings.audio | string | No | off | native, off | Whether to generate audio for the video |
settings.resolution | string | No | 720p | 720p, 1080p, 4k | Resolution of the generated video |
settings.aspect_ratio | string | No | 16:9 | 16:9, 9:16, 1:1 | Aspect ratio (width:height) of generated frames |
settings.duration | int | No | 5 | 3–15 | Video duration in seconds |
options | object | No | - | - | General config such as callback URL and watermark |
options.callback_url | string | No | - | - | Callback URL for task status change notifications |
options.external_task_id | string | No | - | - | Custom task ID |
options.watermark_info | object | No | - | - | Whether to also generate a watermarked result |
promptstring(Required)
Text prompt, which may include positive and negative descriptions. Maximum length: 3072 characters (recommended: ≤ 2500).
Example: A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train.
Multi-shot format: "shot n, m, words; shot n, m, words;" (separated by standard semicolons), where:
n: shot sequence number (1–6 shots supported)m: shot duration in seconds (each shot ≥ 1s; sum of all shot durations must equal the total video duration)words: shot prompt (max 512 characters)
settingsobject(Optional)
Output configuration such as resolution and duration.
Whether to generate multi-shot video. Default true.
When set to false, multi-shot prompts will not produce multi-shot output.
Whether to generate audio for the video. Default off.
native: Include native audio matching the visualsoff: No audio
Output video resolution. Default 720p.
720p: 720P output1080p: 1080P output4k: 4K output
Aspect ratio of generated video frames. Default 16:9.
Options: 16:9, 9:16, 1:1
Video duration in seconds. Default 5.
Options: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
optionsobject(Optional)
General configurations such as callback URL and watermark.
{
"callback_url": "https://example.com/cb",
"external_task_id": "string",
"watermark_info": {
"enabled": false
}
}Callback URL for task result notifications. If set, the server sends a notification when the task status changes.
Custom task ID. Does not overwrite the system-generated task ID and can be used for querying. Must be unique within the account.
Whether to also generate a watermarked result, controlled by enabled:
{
"enabled": false
}true: Include watermarked resultfalse(default): No watermark
Custom watermarks are not supported.
Responses
200: Task created successfully
Content-Type: application/json
Request Example
curl -X POST "https://api.autorouter.top/kling/text-to-video/kling-3.0" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"prompt": "A girl sat on the train, looking out the window with a melancholic expression, her head swaying with the train.",
"settings": {
"resolution": "4k",
"aspect_ratio": "16:9",
"duration": 15,
"audio": "off",
"multi_shot": true
},
"options": {
"callback_url": "https://xxx/callback",
"external_task_id": "",
"watermark_info": {
"enabled": false
}
}
}'Response Example
{
"code": 0,
"message": "string",
"request_id": "string",
"data": {
"id": "string",
"status": "submitted",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string"
}
}Response fields:
| Name | Type | Description |
|---|---|---|
code | integer | Error code; 0 means success |
message | string | Error information |
request_id | string | Request ID generated by the system |
data.id | string | System-generated task ID |
data.status | string | Task status: submitted, processing, succeeded, failed |
data.create_time | integer | Task creation time, Unix timestamp (ms) |
data.update_time | integer | Task update time, Unix timestamp (ms) |
data.external_id | string | Custom task ID for this task, if any |
GET /kling/tasks
Query Video Generation Task (By task ID)
Query async task status and results by system task ID or custom task ID.
The API currently supports querying async tasks only.
- Use either
task_idsorexternal_task_ids, not both - Batch queries are supported; separate multiple IDs with
, - Generated results are cleared after about 30 days; save them promptly
Headers
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
Content-Type | string | Yes | application/json | Data exchange format |
Authorization | string | Yes | - | Auth header. Format: Bearer sk-xxxxxx |
Query Params
| Name | Type | Required | Description |
|---|---|---|---|
task_ids | string | No | System-generated task IDs, comma-separated |
external_task_ids | string | No | Custom task IDs, comma-separated |
Responses
200: Task queried successfully
Content-Type: application/json
Request Example
curl -X GET "https://api.autorouter.top/kling/tasks?task_ids={id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx"Response Example
{
"code": 0,
"message": "string",
"request_id": "string",
"data": [
{
"id": "893605946402811985",
"status": "succeeded",
"message": "string",
"create_time": 1781080778802,
"update_time": 1781080794151,
"external_id": "string",
"outputs": [
{
"type": "video",
"id": "string",
"url": "string",
"watermark_url": "string",
"duration": "15"
}
],
"billing": [
{
"charge_type": "cash",
"cash_type": "balance",
"amount": "string",
"package_type": "video",
"list_price": "string"
}
]
}
]
}Response fields:
| Name | Type | Description |
|---|---|---|
code | integer | Error code; 0 means success |
message | string | Error information |
request_id | string | Request ID generated by the system, used for tracing and troubleshooting |
data | object[] | Task list |
data[].id | string | Task ID being queried |
data[].status | string | Task status: submitted, processing, succeeded, failed |
data[].message | string | Status message; failure reason when failed (e.g. content risk control) |
data[].create_time | integer | Task creation time, Unix timestamp (ms) |
data[].update_time | integer | Task update time, Unix timestamp (ms) |
data[].external_id | string | Custom task ID, if any |
data[].outputs | object[] | Generated results; fields vary by type |
data[].billing | object[] | Billing details |
statusstring
Task status:
submitted: Submittedprocessing: Processingsucceeded: Succeededfailed: Failed
Recommended poll interval: 3–5 seconds until status is succeeded or failed.
outputsobject[]
Generated results. Fields depend on type. Possible values: image, video, audio, element, voice. Text-to-video success typically returns type=video.
| Name | Type | Description |
|---|---|---|
type | string | Always video |
id | string | Video ID generated by the system |
url | string | Result URL (hotlink-protected; cleared after ~30 days, save promptly) |
watermark_url | string | Watermarked result URL (hotlink-protected) |
duration | string | Generated video duration in seconds |
| Name | Type | Description |
|---|---|---|
type | string | Always image |
url | string | Result URL (hotlink-protected; cleared after ~30 days) |
watermark_url | string | Watermarked image download URL (hotlink-protected) |
group_id | string | Appears only for grouped images, marks grouping relationship |
| Name | Type | Description |
|---|---|---|
type | string | Always audio |
id | string | Audio ID generated by the system |
mp3_url | string | MP3 result URL (hotlink-protected; cleared after ~30 days) |
wav_url | string | WAV result URL (hotlink-protected; cleared after ~30 days) |
mp3_duration | string | MP3 duration in seconds |
wav_duration | string | WAV duration in seconds |
| Name | Type | Description |
|---|---|---|
type | string | Always voice |
id | string | Audio ID generated by the system |
name | string | Audio name |
url | string | Material download link |
owned_by | string | Voice source: kling for official library, numbers for creator IDs |
status | string | Status: succeeded, deleted |
| Name | Type | Description |
|---|---|---|
type | string | Always element |
id | string | Element ID generated by the system |
name | string | Element name |
description | string | Element description |
element_type | string | Element type: video_character_elements, multi_image_elements |
references | object[] | Related materials |
references[].type | string | Material type: image, video, voice |
references[].role | string | Role; image: frontal / reference; video and voice: refer |
references[].url | string | Material download link |
references[].id | string | Voice ID (when type=voice) |
references[].name | string | Voice name (when type=voice) |
references[].owned_by | string | Voice source (when type=voice) |
owned_by | string | Element source: kling for official library, numbers for creator IDs |
status | string | Status: succeeded, deleted |
tags | object[] | Element tags |
tags[].id | integer | Tag ID |
tags[].name | string | Tag name |
tags[].description | string | Tag description |
billingobject[]
Billing details.
Consumption account type:
cash: Balance deductionunit: Resource package deduction
Balance type, only when charge_type=cash:
balance: Official quotatest_balance: Test quota
Deduction amount. For charge_type=cash, discounted balance price; for charge_type=unit, resource package units deducted (decimal string).
Resource package type, only when charge_type=unit. Fixed enum: video, image, audio.
Balance list price, only when charge_type=cash.
Error Handling
HTTP 400 Parameter Errors
| Scenario | Suggestion |
|---|---|
Missing prompt | Provide the required field |
Invalid duration / aspect_ratio / resolution | Use documented enum values |
| Multi-shot duration mismatch | Ensure sum of shot durations equals settings.duration |
| Multi-shot shot count > 6 | Use at most 6 shots |
HTTP 401 / 403 Auth Errors
401 Unauthorized: Invalid or expired API Key403 Forbidden: API Key is not allowed to access this model
HTTP 402 Insufficient Balance
Insufficient balance. Please top up in the AutoRouter console.
Task failed Status
| Cause | Suggestion |
|---|---|
| Content moderation failed | Adjust the prompt and avoid sensitive content |
| Invalid parameter combination | Follow the Request Body rules |
When a task fails, AutoRouter automatically refunds your account.
Image-to-Video
Generate video from a first frame or first-and-last frames plus an optional text prompt. Async task API: submit, poll, then download.
Image-to-Video
Generate video from a first frame or first-and-last frames plus prompt and optional Elements with Kling 3.0. Async task API: submit, poll, then download.