PowerShell: Invoke-RestMethod for a 30-second Wan 3.0 clip
Windows PowerShell script that posts a 30-second wan-3.0 job, loops until it completes and saves the MP4 with Invoke-WebRequest. $3.75 at 720p.

On Windows you do not need curl or an SDK to make a 30-second Wan 3.0 clip: Invoke-RestMethod posts the job and parses the JSON, a do ... while loop waits, and Invoke-WebRequest -OutFile saves the MP4. The 720p, 9:16 request below is reserved at $3.75.
The script
Set SUME_API_KEY in the environment first ($env:SUME_API_KEY = ... for the session). The script stops if it is empty.
if (-not $env:SUME_API_KEY) { throw "SUME_API_KEY is empty" }
$auth = @{ Authorization = "Bearer $env:SUME_API_KEY" }
$base = "https://api.sume.com/v1/videos"
$body = @{
model = "wan-3.0"; prompt = "A barista pouring latte art, overhead shot"
duration = 30; resolution = "720p"; aspect_ratio = "9:16"
} | ConvertTo-Json
$job = Invoke-RestMethod -Method Post -Uri $base -Headers ($auth + @{ "Idempotency-Key" = "wan-ps-001" }) `
-ContentType "application/json" -Body $body
do {
Start-Sleep -Seconds 5
$s = Invoke-RestMethod -Uri "$base/$($job.id)" -Headers $auth
} while ($s.status -in "pending", "in_progress")
if ($s.status -ne "completed") { throw "Job ended as $($s.status)" }
Invoke-WebRequest -Uri "$base/$($job.id)/content?index=0" -Headers $auth -OutFile clip.mp4Notes for Windows scripts
durationstays an integer inConvertTo-Json; PowerShell numbers serialise as numbers, so30is sent as30.- On a failed submit,
Invoke-RestMethodthrows. In PowerShell 7 the response body is in$_.ErrorDetails.Message, which is where a402 insufficient_creditsexplanation appears. - The idempotency key belongs on the POST only. Use a new key when the prompt or resolution changes.
Reserve per resolution
| resolution | Reserve for 30 s | Per second |
|---|---|---|
| 480p | $1.875 | $0.0625 |
| 720p | $3.75 | $0.125 |
| 1080p | $7.50 | $0.25 |
Failure cases to handle
Three responses matter for a paid submit.
402 insufficient_credits: Sume cannot reserve the estimated cost from the workspace balance. Submit a less expensive request or wait for included Gen$ or a plan upgrade, then submit again.409 idempotency_conflict: the key was used for a different payload. Mint a new key for a genuinely new request.429: the workspace has no accepted-job capacity right now. Wait, then retry with the same key; the Generation admission page lists the codes.
Task Scheduler
To run it nightly, save the script and register it with Task Scheduler, passing the key through a machine or user environment variable rather than writing it into the script. If the machine may sleep mid-job, store $job.id in a file; the job keeps running on Sume's side and you can poll the same id later.
Sources
Related posts
More in Developers
- Pre-flight an Omni Flash request against the Sume model catalog
A short Python check that reads supported durations, resolutions and aspect ratios for gemini-omni-flash-1.1 via /v1/videos/models.
- Preflight a 3-minute Short with Timeline plan before you pay
POST /v1/timeline-1.0/plan compiles a Short without a job or a reserve and returns billable minutes and the estimate. A runnable Python check for six slots.
- Prompting Omni Flash with sound: write the audio as its own line
Gemini Omni Flash 1.1 always generates audio. A prompt layout that separates picture from sound, three example prompts, and the request on Sume.
- Python: submit, poll and download one Omni Flash clip (v1/videos)
A short Python script that submits a Gemini Omni Flash 1.1 request to Sume's /v1/videos, polls the job until it completes and saves the MP4.
Written by Sume