by Alibaba
Alibaba Wan 3.0 video generation: text-to-video, first/last-frame, and multimodal references (up to 10 images, 5 videos, 5 audio clips). 2–30 second clips at 480P, 720P or 1080P. Billed per second at the output resolution, counting the seconds of reference videos as well as the output.
from $0.0525
per generated second
480p · 720p · 1080p
billing tiers — not the size you send
Async API — Video generation uses an asynchronous flow: submit a job, poll until it completes, then download the file from a separate endpoint. Generation takes minutes, so poll every 3-5 seconds. The examples below show all three steps.
# 1. Submit the job. model, prompt and seconds are required. Each account may hold only a small number of
# unfinished jobs at once — 5 by default, set per deployment — and one over that returns 429
# video_jobs_in_flight_limit.
#
# The model's own options go under "metadata"; every field and the values it accepts are listed below.
# Media go in metadata.content as {type, <type>: {url}, role}: image_url items with role first_frame, last_frame
# or reference_image, video_url items with role reference_video, audio_url items with role reference_audio, each
# a publicly reachable URL. First/last frame and reference media cannot be mixed in one request. Every request
# needs a prompt; metadata.negative_prompt (a string) lists what to avoid.
curl "https://router-api.0g.ai/v1/videos" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-d '{
"model": "wan3.0-video",
"prompt": "A cat surfing a wave at sunset",
"seconds": 5,
"metadata": {
"resolution": "1080P",
"ratio": "adaptive",
"prompt_extend": true,
"watermark": false
}
}'
# Response: {"id": "v0_426354818031858", "status": "queued", "provider_address": "0x..."}
# 2. Poll until status is "completed". Generation takes minutes — 3-5s is a sane interval. The poll answers
# 200 and reports the job's own status, so a failure arrives as 200 + {"status":"failed"}, NOT as an error
# code. The SUBMIT response echoes what you sent; the POLL response reports what was actually rendered — so
# reconcile against the poll. Which fields carry that answer depends on the upstream:
# usage.output_video_duration when the provider reported a duration, size/seconds on some providers and not
# others. Read what is present rather than assuming a particular field.
curl "https://router-api.0g.ai/v1/videos/<VIDEO_ID>" \
-H "Authorization: Bearer <YOUR_API_KEY>"
# 3. Download the finished file. This is where 409 / 424 / 429 live: 409 = not ready yet, 429 = too many
# concurrent downloads (both retryable), 424 = the job failed and has no output (terminal).
curl "https://router-api.0g.ai/v1/videos/<VIDEO_ID>/content" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-o video.mp4
| Input | role | Type | Max | Scenario |
|---|---|---|---|---|
| First frame | first_frame | Image | 1 | First / last frame |
| Last frameRequires First frame | last_frame | Image | 1 | First / last frame |
| Reference image | reference_image | Image | 10 | Multimodal reference |
| Reference video | reference_video | Video | 5 | Multimodal reference |
| Reference audio | reference_audio | Audio | 5 | Multimodal reference |
Media go in metadata.content as {type, <type>: {url}, role}: image_url items with role first_frame, last_frame or reference_image, video_url items with role reference_video, audio_url items with role reference_audio, each a publicly reachable URL. First/last frame and reference media cannot be mixed in one request. Every request needs a prompt; metadata.negative_prompt (a string) lists what to avoid.
| Field | Values | Default |
|---|---|---|
| metadata.resolution | 480P · 720P · 1080P | 1080P |
| metadata.ratio | adaptive · 16:9 · 9:16 · 1:1 · 4:3 · 3:4 | adaptive |
| seconds | 2–30s | 5 |
| metadata.prompt_extend | true · false | true |
| metadata.watermark | true · false | false |
| metadata.seed | Any integer | — |
Billed per second at the output resolution; the seconds of reference videos are billed at the same rate as the output.
Provider Routing
Control which provider handles your request using the X-0G-Provider-* request headers.
X-0G-Provider-Address pins a provider; X-0G-Provider-Identity pins which of its upstreams to route through — both values come from the address and provider_identity fields of GET /v1/providers. Together they address one specific upstream of one provider. Send neither and the router picks by price and health, exactly as before.
curl "https://router-api.0g.ai/v1/videos" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-H "X-0G-Provider-Address: <PROVIDER_ADDRESS>" \
-H "X-0G-Provider-Identity: <UPSTREAM>" \
-H "X-0G-Provider-Sort: latency" \
-H "X-0G-Provider-Allow-Fallbacks: true" \
-d '{
"model": "wan3.0-video",
"prompt": "A cat surfing a wave at sunset",
"seconds": 6
}'