API DocsAI Model APIsVideosWan 2.7

Reference-to-Video

Generate character-consistent video from multimodal references (image, video, audio). Async task API: submit a request, receive a task_id, then poll for status to get the result.

Supports multimodal input (image, video, audio) to generate videos that preserve character appearance and voice consistency. Suitable for single-character performance or multi-character interaction. 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 reference images, reference videos, and optional voice references.

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

Request Body

Content-Type: application/json

Example:

{
  "model": "wan2.7-r2v-2026-06-12",
  "input": {
    "prompt": "Video 1 holds Image 3, sits on the chair in Image 4, plays a gentle country ballad, and says: \"The sunshine is so nice today.\" Image 1 holds Image 2, walks past Video 1, places Image 2 on the table next to Video 1, and says: \"That sounds great, can you sing it again?\"",
    "media": [
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg",
        "reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3"
      },
      {
        "type": "reference_video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
        "reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 10,
    "prompt_extend": false,
    "watermark": true
  }
}

Properties:

NameTypeRequiredDescription
modelstringYesModel name. Available values: wan2.7-r2v, wan2.7-r2v-2026-06-12
inputobjectYesBasic input such as the prompt and media assets
input.promptstringYesText prompt describing elements and visual traits of the generated video. See details below
input.negative_promptstringNoNegative prompt describing content to avoid. Supports Chinese and English. Maximum 500 characters; excess is truncated
input.mediaarrayYesMedia asset array including images, videos, and audio. See details below
input.media[].typestringYesMedia type. Available values: reference_image, reference_video, first_frame. See details below
input.media[].urlstringYesMedia asset URL. Each value may point to one image or one video. See details below
input.media[].reference_voicestringNoAudio URL specifying the voice of the subject in the reference asset. See details below
parametersobjectNoVideo processing parameters such as resolution, aspect ratio, and duration
parameters.resolutionstringNoResolution tier controlling clarity (total pixels); affects billing. Available values: 720P, 1080P (default)
parameters.ratiostringNoAspect ratio. Used when no first frame is provided; ignored when a first frame is provided (output follows the first-frame aspect ratio approximately). Available values: 16:9 (default), 9:16, 1:1, 4:3, 3:4
parameters.durationintegerNoVideo duration in seconds (billed per second). Default: 5. When media includes video: integer in [2, 10]. When media has no video: integer in [2, 15]
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.

promptstring(Required)

Text prompt. Used to describe the elements and visual characteristics expected in the generated video.

Supports Chinese and English. Each Chinese character, letter, or punctuation mark counts as one character; excess is truncated automatically.

  • wan2.7-r2v, wan2.7-r2v-2026-06-12: maximum 5,000 characters.

Reference designation: For Chinese prompts, refer to images as "图1图2" and videos as "视频1视频2". For English prompts, use "Image 1", "Video 1" (space between the word and the number; capitalize the first letter). Order matches the media array. Images and videos are counted separately, so Image 1 and Video 1 can coexist. If there is only one image or one video, you may simplify to "参考图片" / "参考视频" (or "reference image" / "reference video").

Scene description: Suppose Image 1 is a cat and Image 2 is a room, and you want to describe the cat playing in the room. Two styles are supported: direct reference (e.g. "Image 1 plays in Image 2"), or combining the subject with scene details (e.g. "the cat in Image 1 plays in the room of Image 2").

When the reference image is a multi-panel (storyboard) image, describe the content as multiple shots. You do not need to describe every panel—provide key shot content and the model will recognize panel logic and complete the shots. For best results, pass only one multi-panel image per request.

mediaarray(Required)

Media asset array. Assets include images, videos, and audio. Supports image/video input as visual references; images support multi-view. Common uses include referencing characters, props, scenes, etc.

  • Each array element is a media object containing type and url fields.
  • Array order defines the order of character references in the prompt. Images and videos are counted separately, so Image 1 and Video 1 can coexist.
    • The 1st reference_video in the array corresponds to Video 1, the 2nd to Video 2, and so on.
    • The 1st reference_image in the array corresponds to Image 1, the 2nd to Image 2, and so on.

typestring(Required)

Media asset type. Available values:

  • reference_image: Reference image. Provides subject characters (people/animals/objects) and scene references.
  • reference_video: Reference video. Provides subject characters (people/animals/objects) and voice/timbre references. Empty-shot videos are not recommended.
  • first_frame: First-frame image. Generates video based on the first frame; usually contains a subject character (person/animal/object). Supports joint control with other references. Common usages:
    • Subject already appears in the first frame: combine with subject references to reinforce consistency or provide voice reference.
    • Subject does not appear in the first frame: use subject references to define traits of subjects that newly appear during the video.

Material limits:

  • At most 1 first-frame image.
  • At least 1 reference image or reference video; reference images + reference videos ≤ 5.
  • When a reference asset is a subject character, it must contain only a single character.
urlstring(Required)

Media asset URL. Each value may point to one image or one video.

reference_voicestring(Optional)

Audio URL used to specify the voice/timbre of the subject in the reference asset (image/video). Used with reference_image or reference_video. This audio is for timbre reference only and is unrelated to spoken content. Prefer matching the reference audio language with the prompt language for better results.

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-r2v-2026-06-12",
  "input": {
    "prompt": "Video 1 holds Image 3, sits on the chair in Image 4, plays a gentle country ballad, and says: \"The sunshine is so nice today.\" Image 1 holds Image 2, walks past Video 1, places Image 2 on the table next to Video 1, and says: \"That sounds great, can you sing it again?\"",
    "media": [
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/sjuytr/wan-r2v-object-girl.jpg",
        "reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/gbqewz/wan-r2v-girl-voice.mp3"
      },
      {
        "type": "reference_video",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qigswt/wan-r2v-role2.mp4",
        "reference_voice": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260408/isllrq/wan-r2v-boy-voice.mp3"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/rtjeqf/wan-r2v-object3.png"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png"
      },
      {
        "type": "reference_image",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
      }
    ]
  },
  "parameters": {
    "resolution": "720P",
    "ratio": "16:9",
    "duration": 10,
    "prompt_extend": false,
    "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": "52cade0d-905e-9b7d-a01e-xxxxxx",
  "output": {
    "task_id": "18814247-f944-4102-aa4a-xxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-04-02 22:53:19.537",
    "scheduled_time": "2026-04-02 22:53:30.427",
    "end_time": "2026-04-02 23:00:39.287",
    "orig_prompt": "Video 2 holds Image 3 and plays a gentle American country ballad in a cafe, Video 1 smiles at Video 2 and walks toward him...",
    "video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?xxxx"
  },
  "usage": {
    "duration": 15,
    "input_video_duration": 5,
    "output_video_duration": 10,
    "video_count": 1,
    "SR": 720,
    "ratio": "16:9"
  }
}

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
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.ratiostringAspect ratio of the output video. Example: 16:9
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.prompt{"code":"InvalidParameter","message":"...","request_id":"..."}
Missing input.media or illegal media count/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/video/audio URLs are publicly accessible and not expired
Media file out of specFollow image, video, and audio limits in Request Body
Too many assetsReference images + reference videos ≤ 5; at most 1 first_frame
Illegal parameter combo (e.g. duration out of range when video is included)Follow 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