Skip to main content

Wanx-Reference-to-Video API Reference (2.6)

The Wanx 2.6 reference-to-video model supports multimodal input and can use people or objects as the main subject to generate videos of single-character performances or multi-character interactions.

Related documentation: User Guide

Scope

To ensure successful calls, make sure the model, Endpoint URL, and API Key all belong to the same region. Cross-region calls will fail.
The sample code in this document applies to the Singapore region.
Alibaba Cloud Model Studio has launched workspace-dedicated domains for the China (Beijing) and Singapore regions, which deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
  • China (Beijing) region: Migrate from https://dashscope.aliyuncs.com to https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com
  • Singapore region: Migrate from https://dashscope-intl.aliyuncs.com to https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Among them, {WorkspaceId} is your workspace ID, which you can view on the Workspace Details page in the Alibaba Cloud Model Studio console. The existing domains remain available.

HTTP calls

This API uses the legacy protocol and supports only the wan2.6 model.
Since video generation tasks take a long time (usually 1-5 minutes), the API uses asynchronous calls. The entire process consists of two core steps, "Create Task -> poll for results", as follows:

Step 1: Create a task and obtain the task ID

  • Singapore
  • Virginia
  • Frankfurt
  • Beijing
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesisWhen calling, replace {WorkspaceId} with your actual workspace ID.
  • After the task is created successfully, use the task_id returned by the API to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks; just poll for the result.
  • For a beginner's guide, see Postman.

Request Parameters

Request headers
Content-Typestring(Required)Request content type. This parameter must be set to application/json.Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx.X-DashScope-Asyncstring(Required)Asynchronous processing configuration parameter. HTTP requests support asynchronous calls only and must be set to enable.
If this request header is missing, the following error is returned: "current user api does not support synchronous calls".
Request Body
model string (Required)Model name. For the model list and prices, see Model pricing.Example value: wan2.6-r2v-flash.input object (Required)Basic input information, such as prompts.

Property

prompt string (Required)Text prompt. Used to describe the elements and visual characteristics expected in the generated video.Both Chinese and English are supported. Each Chinese character, letter, or punctuation mark counts as one character, and any excess is automatically truncated.
  • wan2.6-r2v-flash: up to 1500 characters.
  • wan2.6-r2v: up to 1500 characters.
Character reference: use identifiers such as "character1, character2" to reference the reference characters. Each reference (video or image) contains a single character only. The model identifies characters in the references only in this way.Example value: character1 happily watches a movie on the sofa.For prompt usage tips, see T2V/I2V prompt guide.negative_prompt string (Optional)Negative prompt, used to describe content that you do not want to appear in the video, constraining the video output.Both Chinese and English are supported; the length must not exceed 500 characters, and any excess is automatically truncated.Example value: low resolution, fault, worst quality, low quality, incomplete, extra fingers, bad proportions, etc.reference_urls array[string] (Required)
reference_urls directly affects the fee. For billing rules, see Billing and throttling.
An array of URLs of the uploaded reference files, supporting both videos and images. Used to extract the character appearance and voice (if any) to generate a video that matches the reference features.
  • Each URL can point to one image or one video:
    • Image count: 0 to 5.
    • Video count: 0 to 3.
    • Total limit: images + videos ≤ 5.
  • When multiple reference files are passed in, the order of characters is defined by the array order. That is, the 1st URL corresponds to character1, the 2nd to character2, and so on.
  • Each reference file contains only one main character. For example, character1 is a little girl, and character2 is an alarm clock.
Supported input formats:
  1. Public URL:
Reference video requirements:
  • Format: MP4, MOV.
  • Duration: 1s to 30s.
  • Video size: no more than 100MB.
Reference image requirements:
  • Format: JPEG, JPG, PNG (transparent channels not supported), BMP, WEBP.
  • Resolution: both width and height must be within [240,8000] pixels.
  • Image size: no more than 20MB.
Example values: ["https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp4", "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.jpg"]
reference_video_urls array[string]
It is recommended to use reference_urls in place of reference_video_urls.
An array of URLs of the uploaded reference video files. Used to extract character appearance and voice (if any) to generate videos that match the reference features.
  • Up to 3 videos are supported.
  • When multiple videos are passed in, the order of the video characters is defined by the array order. That is, the 1st URL corresponds to character1, the 2nd to character2, and so on.
  • Each reference video contains only one character (for example, character1 is a little girl and character2 is an alarm clock).
  • URLs support the HTTP or HTTPS protocol.
Single video requirements:
  • Format: MP4, MOV.
  • Duration: 2 to 30s.
  • File size: the video must not exceed 100MB.
Example values: ["https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp4"]
parameters object (optional)Image processing parameters, such as setting the video resolution, enabling intelligent prompt rewriting, and adding a watermark.

Property

size string (optional)
  • size directly affects the fee: Fee = unit price (based on resolution) × duration (seconds). For the same model: 1080P > 720P. Please confirm the model pricing before making a call.
  • size must be set to a specific value (such as 1280*720), not 1:1 or 720P.
Specifies the resolution of the generated video, in the format width*height. The default value and available enumeration values of this parameter depend on the model parameter, as follows:
  • wan2.6-r2v-flash: the default value is 1920*1080 (1080P). Available resolutions: all resolutions corresponding to 720P and 1080P.
  • wan2.6-r2v: the default value is 1920*1080 (1080P). Available resolutions: all resolutions corresponding to 720P and 1080P.
720P tier: the available video resolutions and their corresponding video aspect ratios are:
  • 1280*720:16:9。
  • 720*1280:9:16。
  • 960*960:1:1。
  • 1088*832:4:3。
  • 832*1088:3:4。
1080P tier: the available video resolutions and their corresponding video aspect ratios are:
  • 1920*1080: 16:9。
  • 1080*1920: 9:16。
  • 1440*1440: 1:1。
  • 1632*1248: 4:3。
  • 1248*1632: 3:4。
duration integer (optional)
duration directly affects the fee. Fee = unit price (based on resolution) × duration (seconds). Please confirm the model pricing before making a call.
The duration of the generated video, in seconds.
  • wan2.6-r2v-flash: the value is an integer in [2, 10]. The default value is 5.
  • wan2.6-r2v: the value is an integer in [2, 10]. The default value is 5.
Example value: 5.shot_type string (optional)Specifies the shot type of the generated video, that is, whether the video consists of one continuous shot or multiple switching shots.Parameter priority: shot_type > prompt. For example, if shot_type is set to "single", even if the prompt contains "generate a multi-shot video", the model still outputs a single-shot video.Available values:
  • single: the default value, outputs a single-shot video
  • multi: outputs a multi-shot video.
Example value: single.
When you want to strictly control the narrative structure of the video (for example, a single shot for product display or multiple shots for a story short film), you can specify it through this parameter.
audio boolean (Optional)
audio directly affects the fee. Videos with audio and videos without audio are priced differently. Confirm the Model Price before calling.
Supported models: wan2.6-r2v-flash.Whether to generate videos with audio.Available values:
  • true: the default value, outputs videos with audio.
  • false: outputs videos without audio.
Example value: true.watermark boolean (Optional)Whether to add a watermark. The watermark is located in the lower-right corner of the video, with the fixed text "AI Generated".
  • false: the default value, no watermark added.
  • true: add the watermark.
Example value: false.seedinteger(Optional)The random number seed, with a value range of [0, 2147483647].If not specified, the system automatically generates a random seed. To improve the reproducibility of generation results, it is recommended to use a fixed seed value.Note that model generation is probabilistic, so even with the same seed, there is no guarantee that each generation result will be exactly identical.
  • Multi-character interaction (reference images and videos)
  • Multi-character interaction (reference videos)
  • Single-character role-playing
  • Generate silent videos
Pass image and video URLs via reference_urls. Also set shot_type to multi to generate multi-shot videos.
# The following URL is for the Singapore region. When calling, replace {WorkspaceId} with your actual workspace ID. URLs vary by region.
curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.6-r2v-flash",
    "input": {
        "prompt": "Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对Character2开口说道:“that sounds great“",
        "reference_urls": [
            "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/aacgyk/wan-r2v-role1.mp4",
            "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4",
            "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png",
            "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
        ]
    },
    "parameters": {
        "size": "1280*720",
        "duration": 10,
        "audio": true,
        "shot_type": "multi",
        "watermark": true
    }
}'

Response Parameters

output objectTask output information.

Property

task_id stringTask ID. The query validity is 24 hours.task_status stringTask status.

Enumerated values

  • PENDING: Task queuing
  • RUNNING: Task processing
  • SUCCEEDED: Task executed successfully
  • FAILED: Task execution failed
  • CANCELED: Task canceled
  • UNKNOWN: Task does not exist or the status is unknown
request_idstringThe unique request identifier. It can be used for request detail tracing and troubleshooting.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.
  • Successful response
  • Error response
Save the task_id for querying task status and results.
{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Step 2: Query results by task ID

  • Singapore
  • Virginia
  • Frankfurt
  • Beijing
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}When calling, replace {WorkspaceId} with your actual workspace ID.
  • Polling recommendations: Video generation takes several minutes. We recommend using a polling mechanism with a reasonable query interval (such as 15 seconds) to obtain results.
  • Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • Result links: A video URL is returned after the task succeeds, valid for 24 hours. We recommend downloading the video immediately after obtaining the URL and transferring it to permanent storage (such as Alibaba Cloud OSS).
  • task_id validity: 24 hours. Once expired, results can no longer be queried, and the API returns the task status as UNKNOWN.

Request parameters

Request headers (Headers)
Authorizationstring(Required)Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx.
URL path parameters (Path parameters)
task_id string (Required)Task ID.
  • Query task results
Replace {task_id} entirely with the task_id value returned by the previous API call. The task_id can be queried within 24 hours. Also replace {WorkspaceId} with the actual workspace ID.
curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

outputobjectTask output information.

Property

task_id string (Required)Task ID.task_status stringTask status.

Enumerated values

  • PENDING: Task queuing
  • RUNNING: Task processing
  • SUCCEEDED: Task executed successfully
  • FAILED: Task execution failed
  • CANCELED: Task canceled
  • UNKNOWN: Task does not exist or the status is unknown
submit_time stringTask submission time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.scheduled_time stringTask execution time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.end_time stringTask completion time. The time zone is UTC+8, in the format YYYY-MM-DD HH:mm:ss.SSS.video_urlstringVideo URL. Returned only when task_status is SUCCEEDED.The URL is valid for 24 hours, and you can download the video via this URL. The video format is MP4 (H.264 encoding).orig_prompt stringThe original input prompt, corresponding to the request parameter prompt.codestringThe error code returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.messagestringThe detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For details, see Error codes.
usage objectOutput information statistics. Only successful results are counted.

Property

input_video_duration integerDuration of the input reference video, in seconds.output_video_duration integerDuration of the output video, in seconds.duration floatTotal video duration. Billing is calculated based on the duration.Calculation formula: duration = input_video_duration + output_video_duration.SR integerResolution tier of the generated video. Example value: 720.sizestringResolution of the generated video. The format is "widthheight". Example value: 1280720.video_count integerThe number of generated videos. Fixed to 1.
request_idstringThe unique request identifier. It can be used for request detail tracing and troubleshooting.
  • Task execution succeeded
  • Task execution failed
  • Task query expired
The video URL is retained for only 24 hours and will be automatically cleared after it expires. Save the generated video in a timely manner.
{
    "request_id": "caa62a12-8841-41a6-8af2-xxxxxx",
    "output": {
        "task_id": "eff1443c-ccab-4676-aad3-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2025-12-16 00:25:59.869",
        "scheduled_time": "2025-12-16 00:25:59.900",
        "end_time": "2025-12-16 00:30:35.396",
        "orig_prompt": "character1在沙发上开心的看电影",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx"
    },
     "usage": {
        "duration": 10.0,
        "size": "1280*720",
        "input_video_duration": 5,
        "output_video_duration": 5,
        "video_count": 1,
        "SR": 720
    }
}

DashScope SDK calls

The SDK parameter naming is basically consistent with the HTTP API, and the parameter structure is encapsulated according to the characteristics of each language. Since reference-to-video tasks take a long time (usually 1-5 minutes), the SDK encapsulates the HTTP asynchronous call process at the underlying layer and supports both synchronous and asynchronous call modes.
The actual duration depends on the number of queued tasks and service execution conditions. Please wait patiently when obtaining the results.

Python SDK invocation

Make sure the DashScope Python SDK version is no lower than 2.0.1 before running the following code.If the version is too low, errors such as "url error, please check url!" may be triggered. Refer to Install SDK to update it.
Set region based on the region where the model is located (pass it in when constructing the Client; the region value varies by region):
  • Singapore
  • Beijing
  • United States
  • Frankfurt
region="ap-southeast-1"When calling, replace {WorkspaceId} with your actual workspace ID.
  • Synchronous call
  • Asynchronous call
A synchronous call blocks and waits until video generation is complete and returns the result.
Request example
import dashscope
import os
from dashscope import DashScopeError

# The following is the configuration for the Singapore (ap-southeast-1) region. Replace {WorkspaceId} with your Model Studio workspace ID. The region value varies by region.
client = dashscope.Client(
    # If DASHSCOPE_API_KEY is not set, replace the following line with: api_key="sk-xxx"
    # API keys are region-specific. Get your API key: https://www.alibabacloud.com/help/model-studio/get-api-key
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    workspace="{WorkspaceId}",
    region="ap-southeast-1",
)

def sample_sync_call_r2v():
    # Synchronous call: blocks until the result is ready; generate is a one-step call (submits the task and waits for completion) that returns a completed Job.
    print('please wait...')
    try:
        job = client.videos.generate(
            model='wan2.6-r2v-flash',
            prompt='Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对Character2开口说道:“that sounds great“',
            # reference_urls is an input-section field, not in the named signature; pass it through extra_input.
            # shot_type and audio are parameters-section fields and are passed through parameters.
            extra_input={'reference_urls': [
                "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/aacgyk/wan-r2v-role1.mp4",
                "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4",
                "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png",
                "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png"
            ]},
            size='1280*720',
            duration=10,
            watermark=True,
            parameters={'shot_type': 'multi', 'audio': True})
        print(job)
        print(job.video_url)
    except DashScopeError as e:
        print(f"HTTP status code: {e.status_code}")
        print(f"Error code: {e.code}")
        print(f"Error message: {e.message}")
        print("See the documentation: https://www.alibabacloud.com/help/model-studio/developer-reference/error-code")

if __name__ == '__main__':
    sample_sync_call_r2v()

Java SDK calls

Make sure the DashScope Java SDK version is no lower than 2.22.14 before running the following code.If the version is too low, errors such as "url error, please check url!" may be triggered. Refer to Install SDK to update it.
Set baseHttpApiUrl based on the region where the model is located:
  • Singapore
  • Beijing
  • Frankfurt
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";When calling, replace {WorkspaceId} with your actual workspace ID.
  • Synchronous call
  • Asynchronous call
A synchronous call blocks and waits until video generation is complete and returns the result.
Request example
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.ArrayList;
import java.util.List;

public class Ref2Video26 {

    static {
        // Singapore region URL. Use the URL for your region.
        Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
    }

    // If you have not configured the environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    // API keys differ by region. Get an API key: https://www.alibabacloud.com/help/model-studio/get-api-key
    public static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void ref2video26() throws ApiException, NoApiKeyException, InputRequiredException {
        VideoSynthesis vs = new VideoSynthesis();
        List<String> referenceUrls = new ArrayList<>();
        referenceUrls.add("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/aacgyk/wan-r2v-role1.mp4");
        referenceUrls.add("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4");
        referenceUrls.add("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/qpzxps/wan-r2v-object4.png");
        referenceUrls.add("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260129/wfjikw/wan-r2v-backgroud5.png");

        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.6-r2v-flash")
                        .prompt("Character2 坐在靠窗的椅子上,手持 character3,在 character4 旁演奏一首舒缓的美国乡村民谣。Character1 对Character2开口说道:“that sounds great“")
                        .referenceUrls(referenceUrls)
                        .shotType(VideoSynthesis.ShotType.MULTI)
                        .audio(Boolean.TRUE)
                        .size("1280*720")
                        .duration(10)
                        .watermark(Boolean.TRUE)
                        .build();
        System.out.println("please wait...");
        VideoSynthesisResult result = vs.call(param);
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        try {
            ref2video26();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}

Error codes

If a model call fails and returns an error message, see Error codes for troubleshooting.