Reference-to-video: create a video task that preserves subject features from reference images/videos
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-r2v",
"input": {
"prompt": "A girl wearing this gown walks slowly through a garden bathed in sunset, the breeze gently lifting her skirt, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/dress.png"
}
]
}
}
'{
"output": {
"task_id": "acda59b4-3b10-4789-a5e5-edadae48adcb",
"task_status": "PENDING"
},
"request_id": "..."
}Wan2.7 Video Generation (Alibaba)
Wan2.7 Reference-to-Video API Reference
Wan2.7-r2v reference-to-video API reference and live playground: preserve subject features from reference images/videos, with multi-subject interaction, voice reference, and split-screen storyboards.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Reference-to-video: create a video task that preserves subject features from reference images/videos
curl --request POST \
--url https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-DashScope-Async: <x-dashscope-async>' \
--data '
{
"model": "wan2.7-r2v",
"input": {
"prompt": "A girl wearing this gown walks slowly through a garden bathed in sunset, the breeze gently lifting her skirt, cinematic lighting",
"media": [
{
"type": "reference_image",
"url": "https://your-cdn.com/dress.png"
}
]
}
}
'{
"output": {
"task_id": "acda59b4-3b10-4789-a5e5-edadae48adcb",
"task_status": "PENDING"
},
"request_id": "..."
}Documentation Index
Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
Use this file to discover all available pages before exploring further.
The Playground on the right lets you debug directly: put
Bearer sk-your-api-key in Authorization, fill in model / input.media / parameters, and send the request. A successful submission returns a task_id; see below for polling and download.This page is the creation endpoint for
wan2.7-r2v (reference-to-video): give reference images/videos and the model preserves their subjects (people/animals/objects) and scene features, generating single-character performances or multi-character interactions. If you need more reference images (up to 9), consider HappyHorse r2v. For the full async flow, see the Wan Overview.- Reference-asset citation convention: in the prompt, use “image 1 / image 2” to refer to
reference_imageand “video 1 / video 2” to refer toreference_video, in the same order as themediaarray (images and videos counted separately). With a single image/video, you can simply write “the reference image” / “the reference video”. - Count limits:
reference_image+reference_videototal ≤5; at most 1first_frame. - Creation requests go to
/wan/api/v1/...withX-DashScope-Async: enable; do not use/v1/videos.
Code examples
curl -X POST "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis" \
-H "X-DashScope-Async: enable" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-r2v",
"input": {
"prompt": "A girl wearing this gown walks slowly through a garden bathed in sunset, the breeze gently lifting her skirt, cinematic lighting",
"media": [
{"type": "reference_image", "url": "https://your-cdn.com/dress.png"}
]
},
"parameters": {"resolution": "720P", "duration": 5, "prompt_extend": true, "watermark": true}
}'
Parameter and media quick reference
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
model | string | ✓ | — | Fixed wan2.7-r2v |
input.prompt | string | ✓ | — | ≤5000 characters; use “image 1/video 1” to reference assets |
input.media | array | ✓ | — | See the media table below |
parameters.resolution | string | 1080P | 720P / 1080P | |
parameters.ratio | string | 16:9 | 16:9 / 9:16 / 1:1 / 4:3 / 3:4 (ignored when a first frame is passed) | |
parameters.duration | int | 5 | 2-10 with a reference video; 2-15 without | |
parameters.prompt_extend | bool | true | Smart rewriting | |
parameters.watermark | bool | false | ”AI generated” watermark |
media[] values
type | Count / limit | Notes |
|---|---|---|
reference_image | ≤5 combined with video | Reference image, provides a subject (person/animal/object) or scene; can attach reference_voice to set the voice |
reference_video | ≤5 combined with image | Reference video, provides subject and voice reference; do not pass empty-scene footage |
first_frame | ≤1 | Optional first frame, jointly controls the starting frame |
reference_voice | attached field | Attached to a reference_image/reference_video to set that subject’s voice (wav/mp3, 1-10s) |
Response format
{
"output": { "task_id": "acda59b4-3b10-4789-a5e5-edadae48adcb", "task_status": "PENDING" },
"request_id": "..."
}
After submitting, poll
GET /v1/tasks/{task_id} until completed, then download the mp4 from result_url (no Authorization header, expires in 24 hours). Reference-to-video usually takes 1-5 minutes; a 10-second polling interval and a 20-minute client timeout are recommended. For the full loop, see Wan Overview · Async call flow.Authorizations
The API Key obtained from the APIYI console
Headers
Async processing switch; must be set to enable
Available options:
enable Body
application/json
Was this page helpful?
⌘I