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.
- Webhook not fired when a job is canceled? Jobs vs runs in Sume
A canceled Sume job sends job.canceled, but a canceled run sends no webhook at all. Which surface you called decides it; how to detect a cancel by polling.
- Webhook payload too large (1 MiB)? Fetch the result URL
A Sume run receipt over 1 MiB arrives with payload null and a payload_too_large error. The run did not fail; fetch the receipt from result_url. Handler steps.
- Webhook endpoint redirect 301 not followed: what Sume does
Sume does not follow redirects on webhook deliveries: a 3xx is a failed attempt, not a delivery. Point webhook_url at the final URL, not a hop.
Written by Sume