Wan 3.0 Python example: submit, poll and download a clip
A short async Python script that submits a Wan 3.0 job to POST /v1/videos, polls until it finishes, and saves the MP4. It uses httpx and the wan-3.0 model id.

To call Wan 3.0 from Python, POST to https://api.sume.com/v1/videos with model: "wan-3.0", poll the polling_url it returns until the status is completed, then download unsigned_urls[0]. The script below does all three with httpx and needs only SUME_API_KEY in your environment.
The endpoint, statuses and download flow come from the Video generation docs, read 2026-09-29.
What does the script look like?
Install with pip install httpx. The Idempotency-Key makes a retried submit return the original job rather than a second one.
import asyncio
import os
import httpx
HEADERS = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"}
BODY = {
"model": "wan-3.0",
"prompt": "A paper boat drifts down a rainy gutter, close camera",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
}
async def main() -> None:
async with httpx.AsyncClient(headers=HEADERS, timeout=60) as client:
r = await client.post("https://api.sume.com/v1/videos", json=BODY,
headers={"Idempotency-Key": "wan-py-001"})
r.raise_for_status()
url = r.json()["polling_url"]
while (job := (await client.get(url)).json())["status"] in ("pending", "in_progress"):
await asyncio.sleep(30)
if job["status"] != "completed":
raise SystemExit(job.get("error"))
video = await client.get(job["unsigned_urls"][0])
open("wan.mp4", "wb").write(video.content)
asyncio.run(main())Which statuses does a job pass through?
| Status | Meaning |
|---|---|
pending | Submitted and queued |
in_progress | The video is being generated |
completed | Ready; download from unsigned_urls |
failed | Generation failed; read the error field |
cancelled | Canceled before it finished |
Do I have to poll?
No. Add "callback_url" (HTTPS) to the body and Sume posts to it when the job reaches a terminal state. Keep polling as a fallback, since a callback can be missed.
What can I change in the request?
duration takes whole seconds from 2 to 30, resolution is 480p, 720p or 1080p, and aspect_ratio is one of 16:9, 4:3, 1:1, 3:4 or 9:16. Add frame_images for a first or last frame, or input_references for images, videos and audio. Wan 3.0 rejects seed and size.
Sources
Related posts
More in Developers
- Wan 3.0 seed and size: why the API returns 400 unsupported_parameter
wan-3.0 on Sume rejects seed and size rather than ignoring them. Use resolution and aspect_ratio instead. Why the 400 happens and how to fix the request.
- Which MCP server lets Claude Code or Cursor generate video and images?
MCP servers that let Claude Code and Cursor make video and images: Sume, fal, Replicate, Runway, Higgsfield. Endpoints, sign-in, billing, setup.
- Idempotency keys for AI video APIs: retry without paying twice
An idempotency key makes a retried create return the original run or job instead of a second paid one. How Sume's Idempotency-Key works on each API.
- Signed webhooks for Sume video runs: events, retries, verification
Sume sends one HMAC-SHA256 signed POST when a Format, Action, or Agent Completion run completes or fails. Verify the raw body and dedupe on request_id.
Written by Sume