Skip to content

Wan 3.0 ​

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 pathPurposeResponse
POST /v1/videos/generationsCreate video task202 Accepted
GET /v1/tasks/{id}Query one task200 OK
GET /v1/tasks/{id}/contentAuthorized video download307 Temporary Redirect
HeaderRequirement
Authorization: Bearer $TOKENLIO_API_KEYRequired. Use a Workspace model-routing Key. Keep it server-side, never in public browser code.
Content-Type: application/jsonRequired. Send JSON, not multipart uploads or URL query parameters.
Idempotency-KeyOptional. 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 ​

GoalTokenlio inputsNotes
Text to videopromptA nonblank prompt is required.
First-frame animationimage_with_roles · first_frameUse first_frame; a prompt can describe motion and camera work.
First and last framesimage_with_roles · first_frame + last_frameA first frame is required; one last frame is optional.
Multimodal referenceimage_urls / video_urls / audio_urlsCombine image, video and audio references; never mix with frame inputs.
Document / webpagefile_url / link_urlChoose 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.

bash
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","prompt":"A quiet landscape at sunrise","duration":5,"resolution":"720p","size":"16:9"}'
bash
TASK_ID='YOUR_TASK_ID'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"
bash
curl --location "$BASE_URL/v1/tasks/$TASK_ID/content" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.mp4

Save 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 ​

FieldTypeRequired / defaultRule
modelstringRequiredThis page's ID is used in examples; send the public ID from your current Workspace catalog.
promptstringMode-dependentUp to 20,000 Unicode characters; provide a nonblank prompt or at least one input URL. No silent truncation.
operationstringgenerateOnly generate; may be omitted. Editing is not supported.
resolutionstring1080p480p / 720p / 1080p; default 1080p. The default is the highest-resolution tier.
seedintegerRandom if omittedInteger 0–2147483647; omit for random generation.
watermarkbooleanfalseBoolean, default false.

Generation controls ​

FieldTypeRequired / defaultRule
durationintegerRequiredExplicit integer 2–30, or -1 for model-selected output duration. Omission, 0 and other negatives are rejected.
sizestringadaptiveadaptive (default), 16:9, 9:16, 1:1, 4:3, 3:4. This is an aspect ratio, not pixel dimensions.
generate_audiobooleantrueBoolean, default true; enabling or disabling output audio has the same reference rate.

Reference inputs ​

FieldTypeRequired / defaultRule
image_urlsstring[]OptionalUp to 10 reference images, indexed in array order.
image_with_rolesobject[]OptionalFirst/last frames or reference images; these role families cannot mix.
video_urlsstring[]OptionalUp to 5 reference clips; see material limits below.
audio_urlsstring[]OptionalUp to 5 references; see material duration/format limits.
file_urlstringOptionalOne reference document URL, mutually exclusive with link_url.
link_urlstringOptionalOne public login-free webpage URL, mutually exclusive with file_url.

Role-tagged image fields ​

FieldTypeRequired / defaultRule
image_with_roles[].urlstringRequiredA public HTTPS image URL.
image_with_roles[].rolestringRequiredfirst_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.

json
{
  "model": "wan3.0-video",
  "prompt": "A quiet landscape at sunrise",
  "duration": 5,
  "resolution": "720p",
  "image_with_roles": [
    {
      "url": "https://cdn.example.com/first.png",
      "role": "first_frame"
    }
  ]
}
json
{
  "model": "wan3.0-video",
  "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"
    }
  ]
}
json
{
  "model": "wan3.0-video",
  "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
}
json
{
  "model": "wan3.0-video",
  "prompt": "A quiet landscape at sunrise",
  "duration": -1,
  "resolution": "480p"
}
json
{
  "model": "wan3.0-video",
  "duration": -1,
  "resolution": "480p",
  "file_url": "https://cdn.example.com/guide.pdf"
}
json
{
  "model": "wan3.0-video",
  "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.

MaterialFormat / sizeDimensions / duration
ImagesJPEG / JPG / opaque PNG / BMP / WEBP; ≤20 MBEach side 240–8000 px, aspect ratio ≤8:1; at most one first and one last frame
Reference videoMP4 / MOV; ≤100 MB each1–15 seconds each, total ≤15; each side 240–4096 px, aspect ratio ≤8:1
Reference audioWAV / MP3; ≤15 MB each1–15 seconds each, total ≤15
DocumentPDF, DOC/DOCX, XLS/XLSX, PPT/PPTX, TXT, MD, KEY, PAGES, NUMBERS≤100 MB and ≤50 pages
WebpagePublic, login-free HTTPS pageKeep accessible throughout the task
  • With video references, total input video duration + output duration must be ≤30 seconds, including duration: -1. Automatic duration is not unlimited duration.
  • 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 seed helps 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
HTTP/1.1 202 Accepted
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "wan3.0-video",
  "status": "queued",
  "assets": []
}
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "wan3.0-video",
  "status": "succeeded",
  "assets": [
    {
      "role": "video",
      "url": "https://files.example.com/video.mp4?signature=EXAMPLE_ONLY"
    }
  ]
}
http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "4b9e421d-79ab-4ed3-a64d-1e04b35755a1",
  "model": "wan3.0-video",
  "status": "failed",
  "assets": [],
  "error": {
    "code": "TASK_TIMEOUT",
    "message": "Video task timed out."
  }
}
http
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "error": {
    "type": "VIDEO_REQUEST_INVALID",
    "message": "VIDEO_REQUEST_INVALID"
  }
}
Response field reference
FieldTypeRule
idstringTask identifier used for query and download.
modelstringThe public model ID for this task.
statusstringqueued / processing / succeeded / failed.
assetsobject[]Empty before results are ready; downloadable outputs after success.
assets[].rolestringvideo for these models.
assets[].urlstringTime-limited private download URL, not a permanent resource address.
messagestring, optionalMay explain pending confirmation; not permission to create again.
error.code / error.messagestring, on failureTask failure information, distinct from creation errors using error.type.
statusMeaningAction
queuedAccepted / awaiting processingKeep the id and query; do not resubmit.
processingGenerating or preparing resultsContinue interval polling; do not download yet.
succeededResult availableDownload through the content endpoint.
failedTerminal failureInspect 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 / stageError or scenarioAction
400 · CreateVIDEO_REQUEST_INVALID / VIDEO_ASSET_INVALIDCheck fields, types, URLs and mutually exclusive modes; correct the request first.
401 / 403Authentication or model access deniedCheck the Workspace model-routing Key and model permissions.
402 · CreateINSUFFICIENT_BALANCEFund the Workspace; check for an existing task before retrying.
404 · Query / downloadMEDIA_TASK_NOT_FOUNDCheck task ID, Key and access scope.
409 · CreateVIDEO_IDEMPOTENCY_CONFLICTKeep original fields, URLs and values identical for the same identifier; do not add default fields.
409 · CreateVIDEO_PRICE_CHANGEDReview current catalog terms before choosing to create again.
409 · DownloadMEDIA_CONTENT_NOT_READYWait for succeeded before downloading.
429 / 503Limit reached / temporarily unavailableReduce frequency and inspect limits; check records first when submission is uncertain.
200 · status: failederror.code: TASK_TIMEOUTTask 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_amount in 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 assets or 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 Prime

Access leading AI models through one unified API