Text-to-Video
Generate video from a text prompt. Async task API: submit a request, receive a task_id, then poll for status to get the result.
Generate a smooth video from a text prompt. Supports multi-shot narrative, custom audio, and auto dubbing. Up to 15 seconds and 1080P resolution.
This is an async task-based API: submit a request to receive a task_id, poll for status, then download the video when complete.
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
Authenticate using a Bearer Token.
Format: Authorization: Bearer sk-xxxxxx
Endpoints
POST /api/v1/services/aigc/video-generation/video-synthesis
Create Video Generation Task
Create a video generation task from a text prompt.
The request header must include X-DashScope-Async: enable.
Request Body
Content-Type: application/json
Example:
{
"model": "wan2.6-t2v",
"input": {
"prompt": "An epic yet adorable scene. A tiny cute cartoon kitten general in finely detailed golden armor and a slightly oversized helmet stands bravely on a cliff. He rides a small but heroic warhorse and says: \"Qinghai Changyun An Xueshan, Gucheng Yaowang Yumen Guan. Huangsha Baizhan Chuan Jinjia, Bupo Loulan Zhong Bu Huan.\" Below the cliff, an endless army of mice charges forward with makeshift weapons. A dramatic large-scale battle inspired by ancient Chinese war epics. Over distant snowy mountains, the sky is heavy with dark clouds. The overall mood blends cuteness with grandeur in a humorous, epic way.",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3"
},
"parameters": {
"size": "1280*720",
"prompt_extend": true,
"duration": 10,
"shot_type": "multi"
}
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. Available values: wan2.6-t2v, wan2.6-t2v-us |
input | object | Yes | Basic input such as the prompt and audio |
input.prompt | string | Yes | Text prompt describing elements and visual traits of the generated video. See details below |
input.negative_prompt | string | No | Negative prompt describing content to avoid. Supports Chinese and English. Maximum 500 characters; excess is truncated |
input.audio_url | string | No | Audio file URL used to drive video generation. See details below |
parameters | object | No | Video processing parameters such as resolution, duration, and shot type |
parameters.size | string | No | Output video resolution in width*height format (e.g. 1280*720); affects billing. See details below |
parameters.duration | integer | No | Video duration in seconds (billed per second). See details below |
parameters.prompt_extend | boolean | No | Whether to enable smart prompt rewriting. See details below |
parameters.shot_type | string | No | Shot type. single (default) for a single continuous shot; multi for multiple shots. See details below |
parameters.watermark | boolean | No | Whether to add a watermark (fixed text "AI生成" in the bottom-right corner). false (default) does not add it; true adds it |
parameters.seed | integer | No | Random seed in [0, 2147483647]. Auto-generated if omitted. A fixed seed improves reproducibility but does not guarantee identical results |
inputobject(Required)
Basic input such as the prompt and audio.
Text prompt describing elements and visual traits of the generated video.
Supports Chinese and English. Each Chinese character or letter counts as one character; excess is truncated.
wan2.6-t2v,wan2.6-t2v-us: maximum 1500 characters.
Example: A kitten runs under the moonlight.
Audio file URL. The model uses this audio to generate the video.
- With audio: The model uses this audio as the driving source.
- Without audio: The model auto-generates matching background music or sound effects based on the video content.
Supported input formats:
- Public URL: HTTP or HTTPS. Example:
https://help-static-aliyun-doc.aliyuncs.com/xxx.mp3 - Temporary URL: OSS protocol; obtain via temporary file URL upload. Example:
oss://dashscope-instant/xxx/xxx.mp3
Audio limits:
- Format: wav, mp3
- Duration: 3–30s
- File size: Max 15MB
- Overflow handling: If the audio is longer than
duration(e.g. 5 seconds), only the first 5 seconds are kept and the rest is discarded. If the audio is shorter than the video duration, the remaining part is silent. For example, with 3s audio and 5s video, the first 3 seconds have sound and the last 2 seconds are silent
parametersobject(Optional)
Video processing parameters such as resolution, duration, and shot type.
Output video resolution in width*height format. Must be a concrete value (e.g. 1280*720), not 1:1 or 720P. Affects billing.
Default and available values depend on model:
wan2.6-t2v,wan2.6-t2v-us: default1920*1080(1080P). Available resolutions: all 720P and 1080P options below.
720P tier:
| Resolution | Aspect ratio |
|---|---|
1280*720 | 16:9 |
720*1280 | 9:16 |
960*960 | 1:1 |
1088*832 | 4:3 |
832*1088 | 3:4 |
1080P tier:
| Resolution | Aspect ratio |
|---|---|
1920*1080 | 16:9 |
1080*1920 | 9:16 |
1440*1440 | 1:1 |
1632*1248 | 4:3 |
1248*1632 | 3:4 |
Output video duration in seconds (billed per second).
wan2.6-t2v: integer in[2, 15]. Default:5wan2.6-t2v-us:5or10. Default:5
Example: 5
Whether to enable smart prompt rewriting. Improves short prompts but increases latency.
true: default, enable rewritingfalse: disable rewriting
When using multi-shot (shot_type: "multi"), this must be set to true.
Specifies whether the video is a single continuous shot or multiple switching shots.
single: default, single continuous shotmulti: multiple shots
Effective only when prompt_extend is true.
Priority: shot_type > prompt. For example, if shot_type is single, the model still outputs a single-shot video even if the prompt asks for multi-shot.
Responses
200: Task created successfully
Content-Type: application/json
400: Invalid request parameters
Content-Type: application/json
429: Rate limit exceeded
Content-Type: application/json
Request Examples
curl -X POST "https://api.autorouter.top/api/v1/services/aigc/video-generation/video-synthesis" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-H "X-DashScope-Async: enable" \
-d '{
"model": "wan2.6-t2v",
"input": {
"prompt": "An epic yet adorable scene. A tiny cute cartoon kitten general in finely detailed golden armor and a slightly oversized helmet stands bravely on a cliff. He rides a small but heroic warhorse and says: \"Qinghai Changyun An Xueshan, Gucheng Yaowang Yumen Guan. Huangsha Baizhan Chuan Jinjia, Bupo Loulan Zhong Bu Huan.\" Below the cliff, an endless army of mice charges forward with makeshift weapons. A dramatic large-scale battle inspired by ancient Chinese war epics. Over distant snowy mountains, the sky is heavy with dark clouds. The overall mood blends cuteness with grandeur in a humorous, epic way.",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250923/hbiayh/%E4%BB%8E%E5%86%9B%E8%A1%8C.mp3"
},
"parameters": {
"size": "1280*720",
"prompt_extend": true,
"duration": 10,
"shot_type": "multi"
}
}'Response Examples
{
"output": {
"task_status": "PENDING",
"task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
},
"request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}Response fields:
| Name | Type | Description |
|---|---|---|
output | object | Task output |
output.task_id | string | Task ID for polling status; valid for 24 hours |
output.task_status | string | Task status. Enum: PENDING, RUNNING, SUCCEEDED, FAILED, CANCELED, UNKNOWN |
request_id | string | Unique request ID for tracing and troubleshooting |
code | string | Error code; returned only on failure |
message | string | Error message; returned only on failure |
GET /api/v1/tasks/{task_id}
Query Task Result by ID
Query task status and result using the task_id returned when creating the task. Query validity is 24 hours.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Authentication. Format: Bearer sk-xxxxxx |
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
task_id | string | Yes | Task ID |
Responses
200: Task queried successfully
Content-Type: application/json
400: Invalid request parameters
Content-Type: application/json
429: Rate limit exceeded
Content-Type: application/json
Request Examples
curl -X GET "https://api.autorouter.top/api/v1/tasks/{task_id}" \
-H "Authorization: Bearer sk-xxxxxx"Response Examples
{
"request_id": "caa62a12-8841-41a6-8af2-xxxxxx",
"output": {
"task_id": "eff1443c-ccab-4676-aad3-xxxxxx",
"task_status": "SUCCEEDED",
"submit_time": "2025-09-29 14:18:52.331",
"scheduled_time": "2025-09-29 14:18:59.290",
"end_time": "2025-09-29 14:23:39.407",
"orig_prompt": "An epic yet adorable scene. A tiny cute cartoon kitten general stands bravely on a cliff.",
"video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
},
"usage": {
"duration": 10,
"size": "1280*720",
"input_video_duration": 0,
"output_video_duration": 10,
"video_count": 1,
"SR": 720
}
}Response fields:
| Name | Type | Description |
|---|---|---|
output | object | Task output |
output.task_id | string | Task ID; query validity 24 hours |
output.task_status | string | Task status. Enum: PENDING, RUNNING, SUCCEEDED, FAILED, CANCELED, UNKNOWN. Polling flow: PENDING → RUNNING → SUCCEEDED / FAILED. First queries are usually PENDING or RUNNING; when status becomes SUCCEEDED, the response includes the video URL; if FAILED, check the error and retry; if CANCELED, the task was canceled and must be resubmitted; if UNKNOWN, the task does not exist or its status is unknown (e.g. invalid task_id or past the 24-hour validity window) |
output.submit_time | string | Submit time, format YYYY-MM-DD HH:mm:ss.SSS |
output.scheduled_time | string | Scheduled execution time, format YYYY-MM-DD HH:mm:ss.SSS |
output.end_time | string | Completion time, format YYYY-MM-DD HH:mm:ss.SSS |
output.video_url | string | Video download URL; returned only when task_status is SUCCEEDED. Link valid for 24 hours; downloadable MP4 (H.264) |
output.orig_prompt | string | Original input prompt corresponding to request parameter prompt |
output.actual_prompt | string | When prompt_extend=true, the system rewrites the input prompt and this field returns the optimized prompt actually used for generation; if prompt_extend=false, this field is omitted. Note: wan2.6 models never return this field regardless of prompt_extend |
output.code | string | Error code; returned only on failure |
output.message | string | Error message; returned only on failure |
usage | object | Output statistics; counted only for successful results |
usage.video_duration | integer | Returned only for wan2.5 and earlier models; used for billing. Generated video duration in seconds. Enum: 5, 10 |
usage.duration | float | Returned only for wan2.6 models; used for billing. Total video duration where duration = input_video_duration + output_video_duration |
usage.input_video_duration | integer | Returned only for wan2.6 models. Always 0 |
usage.output_video_duration | integer | Returned only for wan2.6 models. Output video duration in seconds; equals request parameter duration |
usage.SR | integer | Returned only for wan2.6 models. Output resolution tier. Example: 720 |
usage.size | string | Returned only for wan2.6 models. Output resolution in width*height format. Example: 1920*1080 |
usage.video_ratio | string | Returned only for wan2.5 and earlier models. Output resolution in width*height format. Example: 832*480 |
usage.video_count | integer | Number of output videos; always 1 |
request_id | string | Unique request ID for tracing and troubleshooting |
Error Handling
HTTP 400 Parameter Errors (blocked before submit; no charge)
AutoRouter validates required fields before forwarding upstream:
| Scenario | Response |
|---|---|
Missing input.prompt | {"code":"InvalidParameter","message":"...","request_id":"..."} |
| Unknown model name | {"code":"InvalidParameter","message":"unknown model: ...","request_id":"..."} |
HTTP 401 / 403 Auth Errors
401 Unauthorized: Invalid or expired API Key403 Forbidden: API Key not allowed for this model (check token model whitelist)
HTTP 402 Insufficient Quota
Returns insufficient user quota. Please top up in the AutoRouter console.
Task FAILED Status
The task was submitted but upstream generation failed (output.task_status == "FAILED"). See output.code / output.message for details:
| Cause | Suggestion |
|---|---|
| Content moderation failed | Adjust the prompt; avoid sensitive content |
| Audio URL unreachable | Ensure audio_url is publicly accessible and not expired |
| Audio file out of spec | Follow audio limits in Request Body (format, duration, size) |
| Invalid parameter combination (e.g. size not in list, duration out of range) | Follow Request Body rules |
| Multi-shot without prompt rewriting | When using shot_type: "multi", set prompt_extend: true |
When a task FAILED, AutoRouter automatically refunds to your account. Check refund records on the logs page.