Video Editing
Edit an existing video with instruction-based editing and video transfer. Async task API: submit a request, receive a task_id, then poll for status to get the result.
Supports multimodal input (text / image / video) for instruction-based editing and video transfer. Output duration follows the input video by default (2–10 seconds). Supports up to 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 Editing Task
Create a video editing task from an existing video (pure instruction editing, or instruction + reference image local replacement, etc.).
The request header must include X-DashScope-Async: enable.
Request Body
Content-Type: application/json
Example:
{
"model": "wan2.7-videoedit",
"input": {
"prompt": "Replace the girl's clothes in the video with the clothes from the image",
"media": [
{
"type": "video",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png"
}
]
},
"parameters": {
"resolution": "720P",
"prompt_extend": true,
"watermark": true
}
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. Fixed value: wan2.7-videoedit |
input | object | Yes | Basic input such as the prompt and media assets |
input.prompt | string | No | Text prompt describing the editing intent (e.g. style transfer, local replacement). Supports Chinese and English; each character counts as one; excess is truncated. Maximum 5,000 characters |
input.negative_prompt | string | No | Negative prompt describing content to avoid. Supports Chinese and English. Maximum 500 characters; excess is truncated |
input.media | array | Yes | Media asset list for reference materials needed for video generation (images, videos). See details below |
input.media[].type | string | Yes | Media asset type. Available values: video, reference_image. See details below |
input.media[].url | string | Yes | Media asset URL or Base64-encoded data. Assets include video and images. See details below |
parameters | object | No | Video processing parameters such as resolution, aspect ratio, and prompt rewriting |
parameters.resolution | string | No | Resolution tier controlling clarity (total pixels). Available values: 720P, 1080P (default) |
parameters.ratio | string | No | Aspect ratio of the generated video. See details below |
parameters.duration | integer | No | Output video duration in seconds. Only set this when you need to truncate the video; omit it (or pass the default 0) to keep the input duration. Integer in [2, 10]; when set, the system truncates from second 0 of the source video to the specified length |
parameters.audio_setting | string | No | Audio setting. auto (default): the model decides based on the prompt—may regenerate audio if the prompt mentions sound, otherwise may keep the original audio; origin: force keep the original audio from the input video |
parameters.prompt_extend | boolean | No | Whether to enable smart prompt rewriting. Improves short prompts but increases latency. true (default) enables it; false disables it |
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 media assets.
Media asset list for reference materials needed for video generation (images, videos). Each array element is a media object containing type and url fields.
Media asset type. Available values:
video: Required. The video to edit.reference_image: Optional. Reference image.
Material limits:
- Exactly 1 video.
- Up to 4 reference images.
Media asset URL or Base64-encoded data. Assets include video and images.
parametersobject(Optional)
Video processing parameters such as resolution, aspect ratio, and prompt rewriting.
Aspect ratio of the generated video.
Behavior:
- Omit
ratio: generate a video with an aspect ratio close to the input video. - Provide
ratio: generate the video at the specifiedratio.
Available values:
16:99:161:14:33:4
Output video resolutions (width × height) for each aspect ratio are listed below.
| Resolution tier | Aspect ratio | Output resolution (W*H) |
|---|---|---|
| 720P | 16:9 | 1280*720 |
| 9:16 | 720*1280 | |
| 1:1 | 960*960 | |
| 4:3 | 1104*832 | |
| 3:4 | 832*1104 | |
| 1080P | 16:9 | 1920*1080 |
| 9:16 | 1080*1920 | |
| 1:1 | 1440*1440 | |
| 4:3 | 1648*1248 | |
| 3:4 | 1248*1648 |
Responses
200: Task created successfully
Content-Type: application/json
400: Bad request / invalid parameters
Content-Type: application/json
429: Rate limit exceeded
Content-Type: application/json
Request Example
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.7-videoedit",
"input": {
"prompt": "Replace the girl'\''s clothes in the video with the clothes from the image",
"media": [
{
"type": "video",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4"
},
{
"type": "reference_image",
"url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png"
}
]
},
"parameters": {
"resolution": "720P",
"prompt_extend": true,
"watermark": true
}
}'Response Example
{
"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 (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or 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 Task ID
Query task status and result using the task_id returned when creating the task. Query validity: 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: Bad request / invalid parameters
Content-Type: application/json
429: Rate limit exceeded
Content-Type: application/json
Request Example
curl -X GET "https://api.autorouter.top/api/v1/tasks/{task_id}" \
-H "Authorization: Bearer sk-xxxxxx"Response Example
{
"request_id": "f16ae7e9-d518-92f8-a02c-xxxxxx",
"output": {
"task_id": "05e68c7e-850c-49e4-b866-xxxxxx",
"task_status": "SUCCEEDED",
"submit_time": "2026-04-03 00:08:03.576",
"scheduled_time": "2026-04-03 00:08:13.408",
"end_time": "2026-04-03 00:11:57.286",
"orig_prompt": "Replace the girl's clothes in the video with the clothes from the image",
"video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?xxxx"
},
"usage": {
"duration": 10.04,
"input_video_duration": 5.02,
"output_video_duration": 5.02,
"video_count": 1,
"SR": 720
}
}Response fields:
| Name | Type | Description |
|---|---|---|
output | object | Task output |
output.task_id | string | Task ID. Valid for queries for 24 hours |
output.task_status | string | Task status. Enum: PENDING (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or unknown). Typical poll flow: PENDING → RUNNING → SUCCEEDED / FAILED |
output.submit_time | string | Task submission time, format YYYY-MM-DD HH:mm:ss.SSS |
output.scheduled_time | string | Task execution time, format YYYY-MM-DD HH:mm:ss.SSS |
output.end_time | string | Task 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; video is MP4 (H.264) |
output.orig_prompt | string | Original prompt, corresponding to the request prompt |
output.code | string | Error code. Returned only when the task fails |
output.message | string | Error message. Returned only when the task fails |
usage | object | Output statistics. Returned only on success |
usage.input_video_duration | float | Input video duration in seconds |
usage.output_video_duration | float | Output video duration in seconds |
usage.duration | float | Total video duration used for billing, equal to input_video_duration + output_video_duration |
usage.SR | integer | Output video resolution tier. Example: 720 |
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 (pre-submit validation, no billing)
AutoRouter validates required fields before submitting upstream:
| Scenario | Response |
|---|---|
Missing input.media or video | {"code":"InvalidParameter","message":"...","request_id":"..."} |
| Unknown model | {"code":"InvalidParameter","message":"unknown model: ...","request_id":"..."} |
HTTP 401 / 403 Auth Errors
401 Unauthorized: API Key invalid or expired403 Forbidden: API Key has no access to this model (check token's model allowlist)
HTTP 402 Insufficient Balance
Returns insufficient user quota. Top up at the AutoRouter console.
Task FAILED Status
The task was accepted but upstream generation failed (output.task_status == "FAILED"). See output.code / output.message for details:
| Reason | Suggested Action |
|---|---|
| Content moderation | Adjust prompt to avoid sensitive content |
| Missing video to edit | media must contain exactly one type: video element |
| Invalid reference image count | Reference images: 0–4 type: reference_image |
| Media URL unreachable | Ensure the URL is publicly accessible and not expired |
| Media file violates specs | See video / image limits in Request Body |
| Illegal parameter combo | Follow the Request Body specification |
When a task enters FAILED, AutoRouter automatically refunds the billed quota. Check refund records in the logs page.