Create Wan 3.0 video task
curl --request POST \
--url https://api.haitoken.ai/v1/alibaba/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true,
"audio": true,
"watermark": false,
"seed": -1
}
}
'import requests
url = "https://api.haitoken.ai/v1/alibaba/video/generations"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": True,
"audio": True,
"watermark": False,
"seed": -1
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
model: '<string>',
input: {prompt: '<string>', media: [{type: '<string>', url: '<string>'}]},
parameters: {
resolution: '1080P',
ratio: 'adaptive',
duration: 5,
prompt_extend: true,
audio: true,
watermark: false,
seed: -1
}
})
};
fetch('https://api.haitoken.ai/v1/alibaba/video/generations', 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.haitoken.ai/v1/alibaba/video/generations",
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' => '<string>',
'input' => [
'prompt' => '<string>',
'media' => [
[
'type' => '<string>',
'url' => '<string>'
]
]
],
'parameters' => [
'resolution' => '1080P',
'ratio' => 'adaptive',
'duration' => 5,
'prompt_extend' => true,
'audio' => true,
'watermark' => false,
'seed' => -1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.haitoken.ai/v1/alibaba/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.haitoken.ai/v1/alibaba/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.haitoken.ai/v1/alibaba/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d",
"output": {
"task_id": "cgt-20260730120000-a1b2c3",
"task_status": "PENDING"
}
}Video
Wan 3.0 Video Generation
Generate, edit, and extend videos with native synchronized audio using Wan 3.0 All-in-One models
POST
/
v1
/
alibaba
/
video
/
generations
Create Wan 3.0 video task
curl --request POST \
--url https://api.haitoken.ai/v1/alibaba/video/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true,
"audio": true,
"watermark": false,
"seed": -1
}
}
'import requests
url = "https://api.haitoken.ai/v1/alibaba/video/generations"
payload = {
"model": "<string>",
"input": {
"prompt": "<string>",
"media": [
{
"type": "<string>",
"url": "<string>"
}
]
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": True,
"audio": True,
"watermark": False,
"seed": -1
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
model: '<string>',
input: {prompt: '<string>', media: [{type: '<string>', url: '<string>'}]},
parameters: {
resolution: '1080P',
ratio: 'adaptive',
duration: 5,
prompt_extend: true,
audio: true,
watermark: false,
seed: -1
}
})
};
fetch('https://api.haitoken.ai/v1/alibaba/video/generations', 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.haitoken.ai/v1/alibaba/video/generations",
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' => '<string>',
'input' => [
'prompt' => '<string>',
'media' => [
[
'type' => '<string>',
'url' => '<string>'
]
]
],
'parameters' => [
'resolution' => '1080P',
'ratio' => 'adaptive',
'duration' => 5,
'prompt_extend' => true,
'audio' => true,
'watermark' => false,
'seed' => -1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.haitoken.ai/v1/alibaba/video/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.haitoken.ai/v1/alibaba/video/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.haitoken.ai/v1/alibaba/video/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {\n \"prompt\": \"<string>\",\n \"media\": [\n {\n \"type\": \"<string>\",\n \"url\": \"<string>\"\n }\n ]\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true,\n \"audio\": true,\n \"watermark\": false,\n \"seed\": -1\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d",
"output": {
"task_id": "cgt-20260730120000-a1b2c3",
"task_status": "PENDING"
}
}Wan 3.0 uses All-in-One models. Based on media types in
First-frame and first-last-frame mode only accept
For video editing, use
A successful creation returns the task ID:
input.media and the intent in your prompt, one model can handle text-to-video, first-frame or first-last-frame image-to-video, multimodal reference generation, video editing, and video extension. Unlike Wan 2.7 Video Generation, you do not select separate text, image, or editing models for these capabilities.
This endpoint uses the Wan video task protocol. The X-DashScope-Async header is not required because async task semantics are built into the gateway.
Request structure
The request body has three parts:model, input, and parameters.
| Field | Required | Description |
|---|---|---|
model | Yes | Platform model identifier: wan3.0-video or wan3.0-video-prime |
input.prompt | At least one of input.prompt and input.media | Text prompt, up to 20,000 characters. In multimodal reference mode, use labels such as “image 1”, “video 1”, and “audio 1” to refer to assets in their array order |
input.media | At least one of input.prompt and input.media | Media asset array. Every item contains type and url |
parameters | No | Output resolution, ratio, duration, audio, random seed, prompt expansion, and watermark settings |
media[].url accepts a publicly accessible HTTP/HTTPS URL, an OSS temporary URL, or a base64 data URI. For a base64 data URI, the gateway stores the asset before sending it upstream.
Authentication
Include theAuthorization header in the format Bearer YOUR_API_KEY.
Supported models
| Model identifier | Description |
|---|---|
wan3.0-video | Wan 3.0 general-purpose All-in-One video model |
wan3.0-video-prime | Wan 3.0 Prime All-in-One video model |
Capabilities and media types
Wan 3.0 can generate video with native synchronized audio, up to 30 seconds. Provide assets throughinput.media:
type | Use | Limits and notes |
|---|---|---|
first_frame | First-frame image-to-video | One image maximum; can be paired with last_frame for first-last-frame mode |
last_frame | Last-frame image-to-video | One image maximum; may only be used with first_frame |
reference_image | Reference images | Up to 10 images; each image must be 20 MB or smaller |
reference_video | Reference, editing, or extension video | Up to 5 videos; 15 seconds total, 100 MB per video, and at least 16 fps |
reference_audio | Reference audio | Up to 5 audio files; 15 seconds total and 15 MB per file |
file | Document reference | One file maximum. Supports docx, doc, xlsx, xls, pptx, ppt, pdf, txt, and md |
link | Public web-page reference | One public, no-login web page maximum |
first_frame / last_frame are mutually exclusive with reference_image / reference_video / reference_audio / file / link. Choose either file or link; either can be combined with reference images, video, and audio. The three reference_* types can be freely combined.first_frame and an optional last_frame; do not add audio or other media types. To drive imagery with audio, use multimodal reference mode, for example reference_image plus reference_audio.
Key parameters
| Parameter | Default | Description |
|---|---|---|
resolution | 1080P | Output resolution: 480P, 720P, or 1080P |
ratio | adaptive | Aspect ratio: 16:9, 4:3, 1:1, 3:4, 9:16, or adaptive. adaptive recommends a ratio from the input media and intent |
duration | 5 | Output length in seconds. Without video input, use an integer from 2 to 30; with video input, input-video length plus output length must not exceed 30 seconds. Use -1 for smart duration |
audio | true | Whether to include an audio track. true produces native synchronized audio; false omits the audio track. Both settings have the same price |
seed | -1 | Random seed. Use -1 or an integer from 0 to 2147483647; omit it or set -1 for an automatically generated seed. The same seed does not guarantee identical output |
prompt_extend | true | Whether to expand the prompt. Enabling it often improves short prompts but adds latency. When using file or link, enable it or omit it; do not set it to false |
watermark | false | Whether to add a watermark |
reference_video and state the target edit, such as a replacement, removal, or modification, in the prompt. For video extension, explicitly state how to continue or extend the video. For either mode, ratio: "adaptive" and duration: -1 are recommended.
Quick request
This text-to-video request returns a task ID inoutput.task_id, which you then use to query the result.
import requests
response = requests.post(
"https://api.haitoken.ai/v1/alibaba/video/generations",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "wan3.0-video",
"input": {
"prompt": "A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible."
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"prompt_extend": True,
},
},
)
print(response.json())
const response = await fetch('https://api.haitoken.ai/v1/alibaba/video/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'wan3.0-video',
input: {
prompt: 'A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible.'
},
parameters: {
resolution: '720P',
ratio: '16:9',
duration: 5,
prompt_extend: true
}
})
});
console.log(await response.json());
curl -X POST 'https://api.haitoken.ai/v1/alibaba/video/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "wan3.0-video",
"input": {
"prompt": "A golden retriever runs along the beach at sunset; the camera follows slowly; ocean waves are clearly audible."
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 5,
"prompt_extend": true
}
}'
Scenario examples
First-last-frame image to video
In first-last-frame mode, provide only the first and last frames. Do not mix inreference_*, file, or link.
{
"model": "wan3.0-video",
"input": {
"prompt": "The camera moves steadily through an empty street at dawn and ends at the entrance to a cafe, with cinematic lighting.",
"media": [
{
"type": "first_frame",
"url": "https://example.com/first-frame.jpg"
},
{
"type": "last_frame",
"url": "https://example.com/last-frame.jpg"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true
}
}
File-reference generation
Provide at most onefile, and do not combine it with link. This mode must enable or omit prompt_extend.
{
"model": "wan3.0-video",
"input": {
"prompt": "Create a 10-second premium smart-glasses commercial from the product points in the file, with black, silver gray, and ice blue as the main palette.",
"media": [
{
"type": "file",
"url": "https://example.com/product-brief.pdf"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 10,
"prompt_extend": true
}
}
Web-page and reference-image generation
Use a publicly accessible, no-login page forlink. It can be combined with reference media such as reference_image.
{
"model": "wan3.0-video",
"input": {
"prompt": "Use the product information on the web page and the appearance in image 1 to create a concise product-launch video.",
"media": [
{
"type": "link",
"url": "https://example.com/product-page"
},
{
"type": "reference_image",
"url": "https://example.com/product-reference.jpg"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "16:9",
"duration": 8,
"prompt_extend": true
}
}
Multimodal reference generation
Reference images, videos, and audio can be combined. Images, videos, and audio are each numbered in their array order.{
"model": "wan3.0-video",
"input": {
"prompt": "Have the person in image 1 walk toward the camera in the beach setting from video 1, using the voice and rhythm from audio 1. Keep the result natural and realistic.",
"media": [
{
"type": "reference_image",
"url": "https://example.com/person.jpg"
},
{
"type": "reference_video",
"url": "https://example.com/beach.mp4"
},
{
"type": "reference_audio",
"url": "https://example.com/voice.wav"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true
}
}
Video editing
Usereference_video and state the requested edit directly.
{
"model": "wan3.0-video",
"input": {
"prompt": "Change the sky in the video to a sunset tone while preserving the person's movement and original dialogue.",
"media": [
{
"type": "reference_video",
"url": "https://example.com/input-video.mp4"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "adaptive",
"duration": -1,
"prompt_extend": true
}
}
Video extension
Usereference_video and explicitly describe the continuation direction or next scene.
{
"model": "wan3.0-video",
"input": {
"prompt": "Extend the video forward. Keep panning right to reveal a broader mountain landscape and add natural ambient sound.",
"media": [
{
"type": "reference_video",
"url": "https://example.com/input-video.mp4"
}
]
},
"parameters": {
"resolution": "720P",
"ratio": "adaptive",
"duration": -1,
"prompt_extend": true
}
}
{
"request_id": "8f3d2c1a-9b7e-4f5a-8c2d-1e6f0a9b3c5d",
"output": {
"task_id": "cgt-20260730120000-a1b2c3",
"task_status": "PENDING"
}
}
Next steps
- See Query Wan video task to retrieve generation results
- Compare Wan 2.7 Video Generation for version differences
- See Video generation for the unified protocol
- See the model list for available video models
Headers
API key in the format Bearer YOUR_API_KEY
Example:
"Bearer YOUR_API_KEY"
Request body type
Example:
"application/json"
Body
application/json