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.

4 min readSume
All posts

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?

From Video generation, read 2026-09-29.
StatusMeaning
pendingSubmitted and queued
in_progressThe video is being generated
completedReady; download from unsigned_urls
failedGeneration failed; read the error field
cancelledCanceled 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

All Developers posts

Written by Sume