Wan 3.0 Prime
2–30 seconds / automatic duration · 480p / 720p / 1080p · MP4
Generate video from text, first/last frames or multimodal references, including automatic duration, documents and webpages. All modes create an asynchronous task through the same endpoint and deliver MP4.
Create a Workspace model-routing API Key in the console and copy the exact public API model ID from your Workspace catalog. Documentation describes the contract; it does not grant access to your Workspace or Key.
1. Endpoints and authentication
Base URL · https://api.tokenlio.ai
| Method and path | Purpose | Response |
|---|---|---|
POST /v1/videos/generations | Create video task | 202 Accepted |
GET /v1/tasks/{id} | Query one task | 200 OK |
GET /v1/tasks/{id}/content | Authorized video download | 307 Temporary Redirect |
| Header | Requirement |
|---|---|
Authorization: Bearer $TOKENLIO_API_KEY | Required. Use a Workspace model-routing Key. Keep it server-side, never in public browser code. |
Content-Type: application/json | Required. Send JSON, not multipart uploads or URL query parameters. |
Idempotency-Key | Optional. 1–128 printable ASCII characters, without spaces. Keep one stable identifier per business request; use a new identifier for an independent task. |
2. Choose a generation mode
| Goal | Tokenlio inputs | Notes |
|---|---|---|
| Text to video | prompt | A nonblank prompt is required. |
| First-frame animation | image_with_roles · first_frame | Use first_frame; a prompt can describe motion and camera work. |
| First and last frames | image_with_roles · first_frame + last_frame | A first frame is required; one last frame is optional. |
| Multimodal reference | image_urls / video_urls / audio_urls | Combine image, video and audio references; never mix with frame inputs. |
| Document / webpage | file_url / link_url | Choose one URL; prompt may be omitted. |
TIP
image_urls always means reference images, never implicit first/last frames. Use image_with_roles for frames. The two image fields are mutually exclusive.
3. Quick start
Set TOKENLIO_API_KEY securely in your environment first. Example material domains and task IDs are placeholders, not usable inputs or tasks.
BASE_URL='https://api.tokenlio.ai'
# TOKENLIO_API_KEY is supplied securely by your environment.
curl "$BASE_URL/v1/videos/generations" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"model":"wan3.0-video-prime","prompt":"A quiet landscape at sunrise","duration":5,"resolution":"720p","size":"16:9"}'TASK_ID='YOUR_TASK_ID'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $TOKENLIO_API_KEY"curl --location "$BASE_URL/v1/tasks/$TASK_ID/content" \
-H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.mp4Save the returned id. HTTP 202 means accepted, not completed. Poll every 5–15 seconds and download only when status is succeeded; the query/download tabs are not instructions to run immediately after submission.
4. Request parameters
Basic fields
| Field | Type | Required / default | Rule |
|---|---|---|---|
model | string | Required | This page's ID is used in examples; send the public ID from your current Workspace catalog. |
prompt | string | Mode-dependent | Up to 20,000 Unicode characters; provide a nonblank prompt or at least one input URL. No silent truncation. |
operation | string | generate | Only generate; may be omitted. Editing is not supported. |
resolution | string | 1080p | 480p / 720p / 1080p; default 1080p. The default is the highest-resolution tier. |
seed | integer | Random if omitted | Integer 0–2147483647; omit for random generation. |
watermark | boolean | false | Boolean, default false. |
Generation controls
| Field | Type | Required / default | Rule |
|---|---|---|---|
duration | integer | Required | Explicit integer 2–30, or -1 for model-selected output duration. Omission, 0 and other negatives are rejected. |
size | string | adaptive | adaptive (default), 16:9, 9:16, 1:1, 4:3, 3:4. This is an aspect ratio, not pixel dimensions. |
generate_audio | boolean | true | Boolean, default true; enabling or disabling output audio has the same reference rate. |
Reference inputs
| Field | Type | Required / default | Rule |
|---|---|---|---|
image_urls | string[] | Optional | Up to 10 reference images, indexed in array order. |
image_with_roles | object[] | Optional | First/last frames or reference images; these role families cannot mix. |
video_urls | string[] | Optional | Up to 5 reference clips; see material limits below. |
audio_urls | string[] | Optional | Up to 5 references; see material duration/format limits. |
file_url | string | Optional | One reference document URL, mutually exclusive with link_url. |
link_url | string | Optional | One public login-free webpage URL, mutually exclusive with file_url. |
Role-tagged image fields
| Field | Type | Required / default | Rule |
|---|---|---|---|
image_with_roles[].url | string | Required | A public HTTPS image URL. |
image_with_roles[].role | string | Required | first_frame / last_frame / reference_image. A last frame needs a first frame. |
WARNING
The entire request must fit 64 KiB as well as each field's character limit. Unknown/duplicate fields, null and undocumented parameters are rejected; long prompts are not silently truncated. Omit unused optional fields. Editing's forbidden fields must be absent, not set to 0 or empty strings.
5. Scenario requests
Each tab is a complete JSON body for the same creation endpoint. Replace the material URLs before use.
{
"model": "wan3.0-video-prime",
"prompt": "A quiet landscape at sunrise",
"duration": 5,
"resolution": "720p",
"image_with_roles": [
{
"url": "https://cdn.example.com/first.png",
"role": "first_frame"
}
]
}{
"model": "wan3.0-video-prime",
"prompt": "A quiet landscape at sunrise",
"duration": 5,
"resolution": "720p",
"image_with_roles": [
{
"url": "https://cdn.example.com/first.png",
"role": "first_frame"
},
{
"url": "https://cdn.example.com/last.png",
"role": "last_frame"
}
]
}{
"model": "wan3.0-video-prime",
"prompt": "A quiet landscape at sunrise",
"duration": 10,
"resolution": "480p",
"image_urls": [
"https://cdn.example.com/ref-a.jpg",
"https://cdn.example.com/ref-b.jpg"
],
"video_urls": [
"https://cdn.example.com/reference.mp4"
],
"audio_urls": [
"https://cdn.example.com/reference.mp3"
],
"generate_audio": true,
"seed": 42,
"watermark": false
}{
"model": "wan3.0-video-prime",
"prompt": "A quiet landscape at sunrise",
"duration": -1,
"resolution": "480p"
}{
"model": "wan3.0-video-prime",
"duration": -1,
"resolution": "480p",
"file_url": "https://cdn.example.com/guide.pdf"
}{
"model": "wan3.0-video-prime",
"duration": 10,
"resolution": "720p",
"link_url": "https://example.com/article"
}6. Input requirements and tips
Inputs must be public HTTPS / port 443 URLs. Local paths, private hosts, embedded credentials, fragments, uploads and base64 are not accepted. Each URL is at most 8192 bytes; duplicate material URLs in one request are rejected.
Tokenlio validates URL syntax, counts and parameter combinations and forwards inputs. It does not download, probe, resize, crop, transcode or host input files. The following are material suitability requirements, not proof that Tokenlio inspected the bytes; unsuitable materials can still fail asynchronously.
| Material | Format / size | Dimensions / duration |
|---|---|---|
| Images | JPEG / JPG / opaque PNG / BMP / WEBP; ≤20 MB | Each side 240–8000 px, aspect ratio ≤8:1; at most one first and one last frame |
| Reference video | MP4 / MOV; ≤100 MB each | 1–15 seconds each, total ≤15; each side 240–4096 px, aspect ratio ≤8:1 |
| Reference audio | WAV / MP3; ≤15 MB each | 1–15 seconds each, total ≤15 |
| Document | PDF, DOC/DOCX, XLS/XLSX, PPT/PPTX, TXT, MD, KEY, PAGES, NUMBERS | ≤100 MB and ≤50 pages |
| Webpage | Public, login-free HTTPS page | Keep accessible throughout the task |
- With video references, total input video
duration+ outputdurationmust be ≤30 seconds, includingduration: -1. Automaticdurationis not unlimitedduration. - Reference prompts may refer to image/video/audio indices starting at 1 within each material type. Describe subject, movement, camera, style and sound rather than only a static scene.
- Keep URLs accessible and their content unchanged until completion; signed input links need enough lifetime. Freezing a URL does not freeze its bytes. A fixed
seedhelps comparisons but does not guarantee identical results.
7. Responses and task states
Developer endpoints return the task object directly, without an extra data envelope. These are structural examples, not real tasks; the file address is a placeholder.
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
"model": "wan3.0-video-prime",
"status": "queued",
"assets": []
}HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
"model": "wan3.0-video-prime",
"status": "succeeded",
"assets": [
{
"role": "video",
"url": "https://files.example.com/video.mp4?signature=EXAMPLE_ONLY"
}
]
}HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
"model": "wan3.0-video-prime",
"status": "failed",
"assets": [],
"error": {
"code": "TASK_TIMEOUT",
"message": "Video task timed out."
}
}HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"error": {
"type": "VIDEO_REQUEST_INVALID",
"message": "VIDEO_REQUEST_INVALID"
}
}Response field reference
| Field | Type | Rule |
|---|---|---|
id | string | Task identifier used for query and download. |
model | string | The public model ID for this task. |
status | string | queued / processing / succeeded / failed. |
assets | object[] | Empty before results are ready; downloadable outputs after success. |
assets[].role | string | video for these models. |
assets[].url | string | Time-limited private download URL, not a permanent resource address. |
message | string, optional | May explain pending confirmation; not permission to create again. |
error.code / error.message | string, on failure | Task failure information, distinct from creation errors using error.type. |
| status | Meaning | Action |
|---|---|---|
queued | Accepted / awaiting processing | Keep the id and query; do not resubmit. |
processing | Generating or preparing results | Continue interval polling; do not download yet. |
succeeded | Result available | Download through the content endpoint. |
failed | Terminal failure | Inspect error.code; do not wait for success. |
The download endpoint defaults to video and returns 307 Temporary Redirect. Use curl --location as shown. Request a fresh authorized download if a temporary URL expires; never attach your API Key directly to a file address. Developer task objects do not include accounting details; inspect actual charges in console call records.
8. Troubleshooting
| HTTP / stage | Error or scenario | Action |
|---|---|---|
| 400 · Create | VIDEO_REQUEST_INVALID / VIDEO_ASSET_INVALID | Check fields, types, URLs and mutually exclusive modes; correct the request first. |
| 401 / 403 | Authentication or model access denied | Check the Workspace model-routing Key and model permissions. |
| 402 · Create | INSUFFICIENT_BALANCE | Fund the Workspace; check for an existing task before retrying. |
| 404 · Query / download | MEDIA_TASK_NOT_FOUND | Check task ID, Key and access scope. |
| 409 · Create | VIDEO_IDEMPOTENCY_CONFLICT | Keep original fields, URLs and values identical for the same identifier; do not add default fields. |
| 409 · Create | VIDEO_PRICE_CHANGED | Review current catalog terms before choosing to create again. |
| 409 · Download | MEDIA_CONTENT_NOT_READY | Wait for succeeded before downloading. |
| 429 / 503 | Limit reached / temporarily unavailable | Reduce frequency and inspect limits; check records first when submission is uncertain. |
200 · status: failed | error.code: TASK_TIMEOUT | Task timed out without a customer charge. Creating again is a new task, not polling. |
Common 400 causes: missing duration, a last frame without a first, mixing frames and references, both file_url/link_url, or too many images/videos/audios.
9. Billing and version compatibility
- The console displays per-second reference rates, not a task total or spending cap.
- Inspect
charged_amountin console call records after successful delivery and settlement. Failed/timed-out tasks are not charged; default video timeout is one hour, subject to platform configuration. - 202 proves neither final delivery nor completed charging. Developer create/query results contain no billing detail; empty
assetsor an absent amount do not mean free.
Idempotency and unknown submission results
Idempotency-Key is optional. The same Key, identifier and original parameters reuse the task; changed parameters conflict. Every POST without the header is independent. Query the returned id. If submission times out or is uncertain, check the console usage records before another create request; do not automatically resubmit.
Price-version compatibility
expected_pricing_revision is optional: send it only when you already hold a valid pricing version. Actual-cost models reject max_charge_amount. Catalog video-reference-pricing/v3 describes display rates, not a creation parameter.
Related documentation · Shared video API · Wan 3.0
