API DocsAI Model APIsVideosWan 2.7

Image-to-Video

Supports first-frame, first-and-last-frame, and video continuation. Async task API: submit a request, receive a task_id, then poll for status to get the result.

Supports multimodal input (text / image / audio / video) for three tasks: first-frame video, first-and-last-frame video, and video continuation. 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 media assets and an optional text prompt.

The request header must include X-DashScope-Async: enable.

Request Body

Content-Type: application/json

Example:

{
  "model": "wan2.7-i2v-2026-04-25",
  "input": {
    "prompt": "An urban fantasy art scene. A dynamic graffiti character. A boy painted in spray paint comes alive from a concrete wall. He raps in English at high speed while striking a classic, energetic hip-hop pose. The scene is set under a city railway bridge at night. Light comes from a lone street lamp, creating a cinematic atmosphere full of high energy and incredible detail. The audio is entirely rap, with no other dialogue or noise.",
    "media": [
      {
        "type": "first_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
      },
      {
        "type": "driving_audio",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "duration": 10,
    "prompt_extend": true,
    "watermark": true
  }
}

Properties:

NameTypeRequiredDescription
modelstringYesModel name. Available values: wan2.7-i2v, wan2.7-i2v-2026-04-25
inputobjectYesBasic input such as the prompt and media assets
input.promptstringNoText prompt describing elements and visual traits of the generated video. Supports Chinese and English; each character counts as one; excess is truncated. Maximum 5,000 characters
input.negative_promptstringNoNegative prompt describing content to avoid. Supports Chinese and English. Maximum 500 characters; excess is truncated
input.mediaarrayYesMedia asset list for reference materials (image, audio, and video). See details below
input.media[].typestringYesMedia type. Available values: first_frame, last_frame, driving_audio, first_clip. Each type may appear at most once in media
input.media[].urlstringYesMedia asset URL. Assets include images, audio, and video. See details below
parametersobjectNoVideo processing parameters such as resolution, duration, and prompt rewriting
parameters.resolutionstringNoResolution tier controlling clarity (total pixels); affects billing. The model scales to a nearby total-pixel target; keep the aspect ratio close to the input asset (first frame or first clip). Available values: 720P, 1080P (default)
parameters.durationintegerNoVideo duration in seconds (billed per second). Integer in [2, 15]. Default: 5
parameters.prompt_extendbooleanNoWhether to enable smart prompt rewriting. Improves short prompts but increases latency. true (default) enables it; false disables it
parameters.watermarkbooleanNoWhether to add a watermark (fixed text "AI生成" in the bottom-right corner). false (default) does not add it; true adds it
parameters.seedintegerNoRandom 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.

mediaarray(Required)

Media asset list for the reference materials needed for video generation (images, audio, and video). Each array element is a media object with type and url fields.

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-i2v-2026-04-25",
  "input": {
    "prompt": "An urban fantasy art scene. A dynamic graffiti character. A boy painted in spray paint comes alive from a concrete wall. He raps in English at high speed while striking a classic, energetic hip-hop pose. The scene is set under a city railway bridge at night. Light comes from a lone street lamp, creating a cinematic atmosphere full of high energy and incredible detail. The audio is entirely rap, with no other dialogue or noise.",
    "media": [
      {
        "type": "first_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
      },
      {
        "type": "driving_audio",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "duration": 10,
    "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:

NameTypeDescription
outputobjectTask output
output.task_idstringTask ID for status queries. Valid for 24 hours
output.task_statusstringTask status. Enum: PENDING (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or unknown)
request_idstringUnique request ID for tracing and troubleshooting
codestringError code. Returned only when the request fails
messagestringError message. Returned only when the request fails

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. Queries are valid for 24 hours.

Headers

NameTypeRequiredDescription
AuthorizationstringYesRequest authentication. Format: Bearer sk-xxxxxx

Path Parameters

NameTypeRequiredDescription
task_idstringYesTask 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": "2ca1c497-f9e0-449d-9a3f-xxxxxx",
  "output": {
    "task_id": "af6efbc0-4bef-4194-8246-xxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2025-09-25 11:07:28.590",
    "scheduled_time": "2025-09-25 11:07:35.349",
    "end_time": "2025-09-25 11:17:11.650",
    "orig_prompt": "An urban fantasy art scene. A dynamic graffiti character...",
    "video_url": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.mp4?Expires=xxx"
  },
  "usage": {
    "duration": 15,
    "input_video_duration": 0,
    "output_video_duration": 15,
    "video_count": 1,
    "SR": 720
  }
}

Response fields:

NameTypeDescription
outputobjectTask output
output.task_idstringTask ID. Valid for queries for 24 hours
output.task_statusstringTask status. Enum: PENDING (queued), RUNNING (processing), SUCCEEDED (success), FAILED (failed), CANCELED (canceled), UNKNOWN (missing or unknown). Typical poll flow: PENDINGRUNNINGSUCCEEDED / FAILED
output.submit_timestringTask submission time, format YYYY-MM-DD HH:mm:ss.SSS
output.scheduled_timestringTask execution time, format YYYY-MM-DD HH:mm:ss.SSS
output.end_timestringTask completion time, format YYYY-MM-DD HH:mm:ss.SSS
output.video_urlstringVideo download URL. Returned only when task_status is SUCCEEDED. Link valid for 24 hours; video is MP4 (H.264)
output.orig_promptstringOriginal prompt, corresponding to the request prompt
output.codestringError code. Returned only when the task fails
output.messagestringError message. Returned only when the task fails
usageobjectOutput statistics. Returned only on success
usage.input_video_durationintegerInput video duration in seconds. 0 when not using video continuation
usage.output_video_durationintegerOutput video duration in seconds
usage.durationintegerTotal billed video duration in seconds: input_video_duration + output_video_duration
usage.SRintegerResolution tier of the output video. Example: 720
usage.video_countintegerNumber of output videos. Always 1
request_idstringUnique request ID for tracing and troubleshooting

Error Handling

HTTP 400 Parameter Errors (pre-submit validation, no billing)

AutoRouter validates required fields before submitting upstream:

ScenarioResponse
Missing input.media or illegal media combination{"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 expired
  • 403 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:

ReasonSuggested Action
Content moderationAdjust prompt to avoid sensitive content
Media URL unreachableEnsure image/audio/video URLs are publicly accessible and not expired
Media file out of specFollow image, audio, and video limits in Request Body
Illegal media combinationUse only the documented valid media combinations
Illegal parameter comboFollow the Request Body specification

When a task enters FAILED, AutoRouter automatically refunds the billed quota. Check refund records in the logs page.

On this page