WAN Video Generation

OpenAI compatible: POST /v1/video/generations. Native path: /api/v1/services/aigc/video-generation/video-synthesis. Video Generation API

  • Submit: POST /v1/video/generations
  • Poll: GET /v1/video/generations/{task_id} or GET /v1/tasks/{task_id}

Mutually Exclusive Modes: Start/end frames (first_frame / last_frame) and reference assets (reference_*, file, link) cannot be mixed.


1. OpenAI-Compatible Integration (POST)

  • Path: https://www.tokenpad.ai/v1/video/generations
  • Auth: Authorization: Bearer sk-your_token

A. Text-to-Video

curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "prompt": "A golden retriever running through golden autumn leaves, cinematic slow motion, sunlight filtering through the woods",
    "resolution": "1080P",
    "ratio": "16:9",
    "duration": 5
  }'

B. Image-to-Video (First Frame / Start & End Frames)

1 image -> first frame; 2 images -> start & end frames. You can also specify { "url", "role" } explicitly (role can be written as type).

curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "prompt": "Camera slowly pushes in as the subject naturally turns around, consistent lighting and shadows",
    "images": [
      { "url": "https://example.com/first.png", "role": "first_frame" },
      { "url": "https://example.com/last.png", "role": "last_frame" }
    ],
    "resolution": "720P",
    "duration": 5
  }'

C. Multi-Image Reference Video Generation

curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "prompt": "Use the character appearance from image 1 and street scene from image 2, smooth tracking shot, character walking naturally",
    "images": [
      { "url": "https://example.com/character.png", "role": "reference_image" },
      { "url": "https://example.com/street.png", "role": "reference_image" }
    ],
    "resolution": "1080P",
    "ratio": "16:9",
    "duration": 5
  }'

D. Image + Video + Audio Multimodal Reference

Requires at least one reference image or reference video; audio-only is not supported.

curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "prompt": "Character movements follow the reference video with lip-sync matching the reference audio",
    "images": [
      { "url": "https://example.com/character.png", "role": "reference_image" }
    ],
    "videos": ["https://example.com/motion_ref.mp4"],
    "audios": ["https://example.com/voice_ref.mp3"],
    "resolution": "1080P",
    "duration": 5
  }'

files and links are OpenAI flat extension fields; mapped by default to file and link roles.

curl -X POST https://www.tokenpad.ai/v1/video/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan3.0-video",
    "prompt": "Generate an explainer video based on the reference document and product page content",
    "files": ["https://example.com/brief.pdf"],
    "links": ["https://example.com/product-page"],
    "resolution": "1080P",
    "ratio": "16:9",
    "duration": 5
  }'

2. Polling Result (GET)

curl -X GET https://www.tokenpad.ai/v1/video/generations/video_task_001 \
  -H "Authorization: Bearer sk-your_token_here"

3. OpenAI-Compatible Parameter Dictionary

ParamTypeRequiredDescription
modelstringYese.g., wan3.0-video
promptstringYesText description
images / image_urlsarrayNoSee "Media Formats" and the role table below
videosarrayNoReference videos; default role reference_video
audiosarrayNoReference audio; default role reference_audio; cannot be used as the sole reference
filesarrayNoReference file URLs; default role file
linksarrayNoReference webpage URLs; default role link
resolution / sizestringNoe.g., 720P, 1080P (size is converted to uppercase)
ratiostringNo16:9, 9:16, 1:1, etc.
durationintegerNoSeconds, default 5

Media Formats (applies to images / videos / audios / files / links):

  • Plain URL string: "https://..."
  • Object with role: { "url": "https://...", "role": "reference_image" } (role can be written as type)

Default images Role by Count (when not explicitly specified):

CountDefault role
1first_frame
2first_frame + last_frame
3+All reference_image

All role Values:

roleSource FieldDescription
first_frameimages / image_urlsFirst frame
last_frameimages / image_urlsLast frame
reference_imageimages / image_urlsReference image
reference_videovideosReference video (Wan default)
reference_audioaudiosReference audio
filefilesReference file
linklinksReference webpage

4. Alibaba Bailian Native Routes (Brief)

CapabilityPath
Video submitPOST /api/v1/services/aigc/video-generation/video-synthesis
Task queryGET /api/v1/tasks/{task_id}

Payloads already containing the official input / parameters structure are passed through verbatim; async tasks require X-DashScope-Async: enable.


5. Response Examples

Submit:

{
  "id": "video_task_001",
  "task_id": "video_task_001",
  "status": "pending"
}

Completed:

{
  "id": "video_task_001",
  "status": "completed",
  "data": [{ "url": "https://example.com/output/wan_video.mp4" }]
}

Async polling may return "status": "failed" even with HTTP 200; see Gateway Error Codes & Troubleshooting.

5. Common Error Codes & Troubleshooting

HTTP codes, error body format, and troubleshooting are maintained in one dedicated page (not duplicated under each example).

👉 Gateway Error Codes & Troubleshooting

Quick reference:

CodeMeaning
400Invalid parameters / content moderation or copyright block
402Insufficient account balance (not 429)
429RPS/RPM limits or in-flight task cap (low balance)
403Token / IP / model permission (balance → 402; content filter → 400)
200 + status: failedAsync video/long-task business failure on poll

HTTP status matches call log status_code for traceability by log_id.

Maintenance: update the error-codes article only; this appendix links to it.

Raw Markdown (.md) · llms.txt