Python video fallback ladder when a model id is gone
A short Python ladder posts to Sume's /v1/videos with the first id that exists and moves on after a 404 model_not_found. Needs SUME_API_KEY, and runs.

How do you keep a video job from failing when a model id disappears? Put your preferred ids in a list and try each in order. Sume's video API returns 404 model_not_found for an unknown id, so one 404 is your signal to try the next. The script below does that and stops at the first accepted job.
The ladder
It exits when SUME_API_KEY is empty. The prompt, resolution and duration are placeholders; pick values every id in your list supports, such as 5 seconds at 720p.
import os, sys, httpx
key = os.environ.get("SUME_API_KEY", "")
if not key:
sys.exit("Set SUME_API_KEY first")
LADDER = ["gemini-omni-flash-1.1", "seedance-2.5", "wan-3.0"]
body = {"prompt": "A paper boat on a rainy street",
"duration": 5, "resolution": "720p"}
hdr = {"Authorization": f"Bearer {key}"}
for model in LADDER:
r = httpx.post("https://api.sume.com/v1/videos",
headers=hdr, json={**body, "model": model},
timeout=60)
if r.status_code == 404:
print("skip", model)
continue
r.raise_for_status()
print("accepted", model, r.json().get("id"))
break
else:
sys.exit("no model in the ladder was accepted")What the ladder does not cover
A 404 is only one failure. A 400 unsupported_capability means the model cannot do what you asked, and a 402 insufficient_credits means no other id will work either, so the loop raises on those instead of moving on. Because raise_for_status runs after the 404 check, those codes stop the script with a clear error.
Order the ladder by what you need, not by price: put the model whose look you want first. Sume bills the list price times 1.25, rounded up to cents, so a fallback can cost more or less than the first choice.
| Status | Meaning in Sume docs | Ladder action |
|---|---|---|
| 404 model_not_found | Id is not listed | Try next id |
| 400 unsupported_capability | Model cannot do the request | Stop and fix the request |
| 402 insufficient_credits | Balance too low | Stop |
Next steps
Poll GET /v1/videos/{id} until the status is completed, then download from GET /v1/videos/{id}/content. Statuses map from queued to pending and processing to in_progress, so a loop that waits on pending and in_progress is enough.
Keeping the ladder honest
Test each rung once with a short clip so you know every id accepts your body. Models differ: Omni allows 3 to 10 seconds and 16:9 or 9:16 only, Wan 3.0 starts at 2 seconds, and Seedance 2.5 starts at 4. The 5 second, 720p body above is inside all three, which is why it works as a template. Add fields such as aspect_ratio only after checking they are valid for every id in the ladder, because an unsupported value on one rung will end the loop at that rung with a 400.
The script needs httpx, installed with pip. The request is a plain JSON POST with a bearer key, matching the OpenRouter-style shape Sume documents for /v1/videos, and the job id in the response is what you poll next. Log which rung accepted, so a quiet drift to a fallback id shows up in your metrics instead of in a surprised invoice.
Sources
Related posts
More in Developers
- R httr2: submit an AI video job, poll it, and save the MP4 (Wan 3.0)
An R script posts a Wan 3.0 job to Sume with httr2, loops on /v1/jobs/{id}/status using next_poll_after_seconds and writes the finished clip to disk.
- Rails Sidekiq job that polls an AI video API with perform_in
A Sidekiq worker reads Sume's /v1/jobs/{id}/status once, then reschedules itself with perform_in using next_poll_after_seconds until the job is terminal.
- Rails Active Job that polls an AI video API: retry_job and wait
An Active Job on Solid Queue reads Sume's job status once and calls retry_job with wait from next_poll_after_seconds until the video job is terminal.
- Read Sume TTS raw PCM in Python: f32le samples at 24 kHz
Ask the TTS Router for container raw, 24000 Hz and pcm_f32le, then load the samples with the standard library for DSP or a custom player.
Written by Sume