Video generation: create a Wan3.0 video task
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting"
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting" }
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan3.0-video',
input: {
prompt: 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan3.0-video',
'input' => [
'prompt' => 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "9db29626-79fc-40d1-b9c2-c6b0caf8ac15",
"task_status": "PENDING"
},
"request_id": "e616d8c9-1147-9ecd-b2b5-abbbe89a4642"
}Wan3.0 Video Generation (Alibaba)
Wan3.0 Video Generation API Reference
Wan3.0 video generation API reference and live Playground: one model ID covers text-to-video, image-to-video, reference-to-video and video editing, up to 30 seconds, 480P-1080P, DashScope async passthrough endpoint.
POST
/
wan
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
Video generation: create a Wan3.0 video task
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting"
}
}
'import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting" }
}
headers = {
"X-DashScope-Async": "<x-dashscope-async>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-DashScope-Async': '<x-dashscope-async>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan3.0-video',
input: {
prompt: 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
}
})
};
fetch('https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan3.0-video',
'input' => [
'prompt' => 'A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-DashScope-Async: <x-dashscope-async>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-DashScope-Async", "<x-dashscope-async>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
.header("X-DashScope-Async", "<x-dashscope-async>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-DashScope-Async"] = '<x-dashscope-async>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, seagulls, cinematic lighting\"\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "9db29626-79fc-40d1-b9c2-c6b0caf8ac15",
"task_status": "PENDING"
},
"request_id": "e616d8c9-1147-9ecd-b2b5-abbbe89a4642"
}Use the Playground on the right to test directly: put
Bearer sk-your-api-key in Authorization, fill in model / input / parameters, and send. A successful submit returns a task_id; polling and download are covered below.Wan3.0 covers every mode through one model ID — what you send as media decides what it does. The full async workflow, status table, billing rules and Python client live in the Wan3.0 overview.
- Create requests must go to
/wan/api/v1/services/aigc/video-generation/video-synthesiswith theX-DashScope-Async: enableheader. Do not use/v1/videos(media fields are dropped and billing is inaccurate). durationmust be an integer (5, not"5"); writeresolutionin uppercase (720P).- Terminal states are
completed/failed, notSUCCEEDED.
Four modes, one field
| Mode | What to put in media |
|---|---|
| Text-to-video | Omit media |
| Image-to-video | [{ "type": "first_frame", "url": "..." }] |
| First/last-frame video | first_frame + last_frame |
| Reference-to-video | reference_image / reference_video / reference_audio (can be mixed) |
first_frame / last_frame cannot be mixed with reference_* / file / link.Code samples
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": "wan3.0-video",
"input": {
"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks, cinematic lighting"
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"prompt_extend": true
}
}'
import requests
url = "https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis"
headers = {
"Authorization": "Bearer sk-your-api-key",
"Content-Type": "application/json",
"X-DashScope-Async": "enable", # required when creating a task
}
body = {
"model": "wan3.0-video",
"input": {"prompt": "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks"},
"parameters": {"resolution": "720P", "ratio": "16:9", "duration": 5, "prompt_extend": True},
}
resp = requests.post(url, json=body, headers=headers, timeout=30)
task_id = resp.json()["output"]["task_id"]
print("task_id:", task_id)
const res = await fetch(
"https://api.apiyi.com/wan/api/v1/services/aigc/video-generation/video-synthesis",
{
method: "POST",
headers: {
Authorization: "Bearer sk-your-api-key",
"Content-Type": "application/json",
"X-DashScope-Async": "enable",
},
body: JSON.stringify({
model: "wan3.0-video",
input: { prompt: "A lighthouse by the sea at dusk, slow dolly-in, waves on the rocks" },
parameters: { resolution: "720P", ratio: "16:9", duration: 5, prompt_extend: true },
}),
}
);
const data = await res.json();
console.log("task_id:", data.output.task_id);
Image-to-video (first frame)
{
"model": "wan3.0-video",
"input": {
"prompt": "The cat turns toward the camera and blinks",
"media": [{ "type": "first_frame", "url": "https://example.com/cat.jpg" }]
},
"parameters": { "resolution": "720P", "duration": 5 }
}
Reference-to-video (reference image + reference video)
{
"model": "wan3.0-video-prime",
"input": {
"prompt": "Replace the person in video 1 with the person in image 1, keep everything else",
"media": [
{ "type": "reference_image", "url": "https://example.com/person.jpg" },
{ "type": "reference_video", "url": "https://example.com/source.mp4" }
]
},
"parameters": { "resolution": "720P", "ratio": "9:16", "duration": 5 }
}
Reference video duration is billed. In the example above, a 10-second reference with a 5-second output bills 15 seconds. Input + output is capped at 30 seconds. See billing rules.
Polling and download
# Poll every 5-10 seconds (never below 3)
curl "https://api.apiyi.com/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer sk-your-api-key"
# Download: result_url is a signed OSS link - do not send Authorization
curl -o out.mp4 "$RESULT_URL"
| Status | Meaning | Next step |
|---|---|---|
submitted | Queued | Keep polling |
in_progress | Generating | Keep polling |
completed | Done | Download from result_url |
failed | Failed | Check error.message; not billed |
Price at a glance
The default rate is 98% of Alibaba’s official price; with the highest top-up bonus it drops to ~81.7%.| Model | Resolution | Default | With 10% bonus | With 20% bonus | 20%-bonus price in CNY |
|---|---|---|---|---|---|
wan3.0-video | 480P | $0.0294/sec | $0.0267/sec | $0.0245/sec | ¥0.1715/sec |
wan3.0-video | 720P | $0.0588/sec | $0.0535/sec | $0.049/sec | ¥0.343/sec |
wan3.0-video | 1080P | $0.1176/sec | $0.1069/sec | $0.098/sec | ¥0.686/sec |
wan3.0-video-prime | 480P | $0.063/sec | $0.0573/sec | $0.0525/sec | ¥0.3675/sec |
wan3.0-video-prime | 720P | $0.126/sec | $0.1145/sec | $0.105/sec | ¥0.735/sec |
wan3.0-video-prime | 1080P | $0.252/sec | $0.2291/sec | $0.21/sec | ¥1.47/sec |
Prices match the provider’s official rates and may change along with them; the table above is for reference only, and the Model Pricing tab in the top navigation is authoritative: Model Pricing.
Full parameters, billing rules and best practices
Wan3.0 overview
Authorizations
APIYI API key, format: Bearer sk-your-api-key
Headers
Async switch. Must be set to enable, otherwise the upstream returns: current user api does not support synchronous calls
Available options:
enable Body
application/json
Was this page helpful?