Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan 2.6 — Gerar a partir de referência
Enviar vídeo de referência
Gere vídeos de desempenho naturais e realistas a partir de entradas multimodais (texto, imagem ou vídeo). Use uma pessoa ou objeto como personagem principal.
- Recursos básicos: Defina duração (2–10s), resolução (720P/1080P) e marcas d’água.
- Retrato do personagem: replique a aparência da imagem ou vídeo de referência. Os vídeos também reproduzem o timbre da voz. Suporta performances de um ou vários personagens.
- Narrativa multi-shot: A programação inteligente de multi-shot mantém a consistência dos personagens em diálogos e interações.
OpenAPI
openapi: 3.1.0
info:
title: Wan Reference-to-Video API
description: Wan reference-to-video API. Generates performance videos from reference images or videos with multimodal input (text, image, video). Supports single or multi-character interactions, multi-shot narrative, and audio-video sync.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/services/aigc/video-generation/video-synthesis:
post:
operationId: createRefToVideo
summary: Create reference-to-video task
description: Create a reference-to-video generation task.
parameters:
- name: X-DashScope-Async
in: header
required: true
description: Must be `enable` to create an asynchronous task.
schema:
type: string
enum:
- enable
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/RefToVideoRequest"
responses:
"200":
description: Task created successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/AsyncTaskSubmitResponse"
"400":
description: Invalid request parameters.
content:
application/json:
schema:
$ref: "#/components/schemas/DashScopeErrorResponse"
x-codeSamples:
- lang: curl
label: Multi-character (submit task)
source: |-
curl --location 'https://maas.qwencloudapi.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 sits on a chair by the window, holding character3, and plays a soothing American country folk song next to character4. Character1 says to 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
}
}'
- lang: curl
label: Single-character (submit task)
source: |-
curl --location 'https://maas.qwencloudapi.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": "Create a festive holiday unboxing experience. Shot 1 [0-2s]: Character1 sits by a beautifully decorated Christmas tree with twinkling lights, holding a wrapped gift box with elegant red and gold wrapping. Shot 2 [2-4s]: Close-up as Character1 carefully unwraps the gift, revealing premium skincare products inside. Shot 3 [4-6s]: Character1 applies the product with delight, saying: \"This holiday glow is exactly what I wanted!\" Shot 4 [6-10s]: Character1 admires their radiant skin in a handheld mirror, surrounded by festive decorations, ending with a warm smile to camera.",
"reference_urls": ["https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mjgmzx/wan-r2v-role-4.mp4"]
},
"parameters": {
"size": "1280*720",
"duration": 10,
"shot_type": "multi",
"watermark": true
}
}'
- lang: curl
label: Silent video (submit task)
source: |-
curl --location 'https://maas.qwencloudapi.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": "character1 drinks bubble tea while dancing spontaneously to the music.",
"reference_urls": ["https://cdn.wanx.aliyuncs.com/static/demo-wan26/vace.mp4"]
},
"parameters": {
"size": "1280*720",
"duration": 5,
"shot_type": "multi",
"audio": false,
"watermark": true
}
}'
- lang: python
label: Python - Synchronous call
source: |-
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_sync_call():
print('Please wait...')
rsp = VideoSynthesis.call(
api_key=api_key,
model='wan2.6-r2v-flash',
prompt='A person smiles and slowly walks forward',
reference_urls=['https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4'],
size='1280*720',
duration=5,
shot_type='single',
watermark=True)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_sync_call()
- lang: python
label: Python - Asynchronous call
source: |-
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call():
rsp = VideoSynthesis.async_call(
api_key=api_key,
model='wan2.6-r2v-flash',
prompt='A person smiles and slowly walks forward',
reference_urls=['https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4'],
size='1280*720',
duration=5,
shot_type='single',
watermark=True)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call()
- lang: java
label: Java - Synchronous call
source: |-
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.*;
public class WanR2V {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
public static void main(String[] args) {
try {
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("size", "1280*720");
parameters.put("duration", 5);
parameters.put("shot_type", "single");
parameters.put("watermark", true);
VideoSynthesisParam param = VideoSynthesisParam.builder()
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.model("wan2.6-r2v-flash")
.prompt("A person smiles and slowly walks forward")
.parameters(parameters)
.referenceUrls(Collections.singletonList("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4"))
.build();
System.out.println("Please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
}
}
- lang: java
label: Java - Asynchronous call
source: |-
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.*;
public class WanR2V {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
public static void main(String[] args) {
try {
String apiKey = System.getenv("DASHSCOPE_API_KEY");
VideoSynthesis vs = new VideoSynthesis();
Map<String, Object> parameters = new HashMap<>();
parameters.put("size", "1280*720");
parameters.put("duration", 5);
parameters.put("shot_type", "single");
parameters.put("watermark", true);
VideoSynthesisParam param = VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-r2v-flash")
.prompt("A person smiles and slowly walks forward")
.parameters(parameters)
.referenceUrls(Collections.singletonList("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/en-US/20260205/mmizqq/wan-r2v-role2.mp4"))
.build();
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("Please wait...");
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
}
}
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
RefToVideoRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: Model name.
enum:
- wan2.6-r2v-flash
- wan2.6-r2v
example: wan2.6-r2v-flash
input:
$ref: "#/components/schemas/RefToVideoInput"
parameters:
$ref: "#/components/schemas/RefToVideoParameters"
RefToVideoInput:
type: object
required:
- prompt
- reference_urls
description: Input data for reference-to-video generation.
properties:
prompt:
type: string
description: Text prompt describing the desired video content. Use `character1`, `character2`, etc. to reference characters from the `reference_urls` array in order. Each reference must contain only a single character.
example: 'Character1 says to Character2: "that sounds great"'
reference_urls:
type: array
description: Array of reference image or video URLs. Up to 5 URLs total (up to 5 images, up to 3 videos). Each reference must contain a single character. The order determines character identifiers (`character1`, `character2`, etc.).
items:
type: string
format: uri
minItems: 1
maxItems: 5
example:
- https://example.com/person1.mp4
- https://example.com/person2.mp4
- https://example.com/object.png
RefToVideoParameters:
type: object
description: Generation parameters for reference-to-video.
properties:
size:
type: string
description: Output resolution as `width*height`. Determines the video aspect ratio (e.g., `1280*720` for 16:9, `720*1280` for 9:16).
enum:
- 1280*720
- 720*1280
- 960*960
- 1920*1080
- 1080*1920
example: 1280*720
duration:
type: integer
description: Video duration in seconds. Integer from 2 to 10 for both models.
minimum: 2
maximum: 10
example: 10
audio:
type: boolean
description: "Generate audio in the video. `true` (default): generate video with audio. `false`: generate silent video. Silent video is only supported by `wan2.6-r2v-flash`."
default: true
shot_type:
type: string
description: "Shot mode. `multi`: multi-shot switching for enhanced expressiveness with natural dialogue and scene transitions. `single`: fixed single-shot perspective."
enum:
- multi
- single
example: multi
watermark:
type: boolean
description: Add watermark to the output video.
default: false
AsyncTaskSubmitResponse:
type: object
description: Response returned when an asynchronous task is created successfully.
properties:
request_id:
type: string
description: Unique request identifier.
output:
type: object
properties:
task_id:
type: string
description: Task identifier. Use this with `GET /tasks/{task_id}` to poll for results.
task_status:
type: string
description: Initial task status, typically `PENDING`.
enum:
- PENDING
TaskStatusResponse:
type: object
description: Response containing the current status and results of a reference-to-video task.
properties:
request_id:
type: string
description: Unique request identifier.
output:
type: object
properties:
task_id:
type: string
description: Task identifier.
task_status:
type: string
description: Current task status.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
video_url:
type: string
format: uri
description: Generated video URL. Only present when `task_status` is `SUCCEEDED`. Valid for 24 hours — download promptly.
code:
type: string
description: Error code. Only present when `task_status` is `FAILED`.
message:
type: string
description: Error message. Only present when `task_status` is `FAILED`.
usage:
type: object
description: Usage statistics (only present when task succeeds).
properties:
video_count:
type: integer
description: Number of videos generated.
video_duration:
type: integer
description: Duration of the generated video in seconds.
DashScopeErrorResponse:
type: object
description: DashScope API error response.
properties:
request_id:
type: string
description: Unique request identifier.
code:
type: string
description: Error code (e.g., `InvalidParameter`, `Throttling`, `Unauthorized`).
example: InvalidParameter
message:
type: string
description: Human-readable error message.
example: "Invalid parameter: size"