Wan API Documentation
Buy credits, generate a key, and call Wan through a simple endpoint. If you've used the OpenAI API before, you already know this one.
wanapi.io is an independent proxy and reseller for Wan. Endpoints below point at our proxy; responses originate from Wan models.
Introduction
The Wan API exposes a REST interface modeled on the OpenAI specification. You authenticate with a bearer token and receive standard JSON responses, so the official OpenAI SDKs and most HTTP clients work with minimal changes.
Base URL
Authentication
The API uses bearer token authentication. Create a key from your dashboard after topping up credits, then pass it on every request:
# HTTP headers
Authorization: Bearer sk-wan-your-key
Content-Type: application/jsonKeep keys secret. Treat API keys like passwords — never embed them in client-side code or commit them to a repository. Rotate or revoke a leaked key instantly from your dashboard.
Quickstart
Python
import time, requests
BASE = "https://api.wanapi.io/v1"
H = {"Authorization": "Bearer sk-wan-your-key"}
# 1. create a generation task
task = requests.post(f"{BASE}/video/generations", headers=H, json={
"model": "wan-2-2",
"prompt": "a drone shot over a misty forest at sunrise",
"duration": 5,
"aspect_ratio": "16:9",
}).json()
# 2. poll until the video is ready
while True:
res = requests.get(f"{BASE}/video/generations/{task['id']}", headers=H).json()
if res["status"] in ("succeeded", "failed"):
break
time.sleep(5)
print(res["video_url"])cURL
curl https://api.wanapi.io/v1/video/generations \
-H "Authorization: Bearer sk-wan-your-key" \
-H "Content-Type: application/json" \
-d '{"model": "wan-2-2", "prompt": "ocean waves at golden hour", "duration": 5}'Create a video
Submits an asynchronous generation task and returns a task id immediately.
model—wan-2-2orwan-2-1. Required.prompt— text description.image— optional URL for image-to-video.duration— clip length in seconds.aspect_ratio— e.g.16:9.
{ "id": "gen_abc123", "status": "queued" }Poll the task
Poll until status is succeeded (or supply a webhook_url when creating the task to be notified instead).
{ "id": "gen_abc123", "status": "succeeded", "video_url": "https://cdn.wanapi.io/v/abc.mp4" }Models
| Model ID | Name |
|---|---|
| wan-2-2 | Wan 2.2 |
| wan-2-1 | Wan 2.1 |
Errors
Conventional HTTP status codes are used, with an OpenAI-style error body: { "error": { "message", "type", "code" } }.
| Code | Meaning |
|---|---|
| 400 | Malformed request |
| 401 | Invalid or missing API key |
| 402 | Insufficient credits — top up your balance |
| 429 | Rate limit exceeded |
| 500 / 503 | Upstream or proxy error — retry with backoff |
Rate limits
Rate limits scale with your plan and balance. When you exceed a limit you'll receive a 429 with a Retry-After header — back off and retry. Need a custom limit? Contact us.
Ready to build? Get your API key and make your first call in minutes.