Python script: filter Sume video models by length, size and ratio

A short Python script reads GET /v1/videos/models and keeps the rows that fit your seconds, resolution and aspect ratio. Run it before you pick an id.

4 min readSume
All posts

Yes, you can pick a Sume video model from code instead of memory. GET /v1/videos/models returns each row with its supported_* fields, so a filter on length, resolution and aspect ratio gives you the ids that can serve a request. The script below prints matching ids and exits non-zero when none match.

The script

It reads the key from SUME_API_KEY, accepts the three constraints as arguments and treats missing fields as no match.

import os, sys, requests

secs, res, ratio = int(sys.argv[1]), sys.argv[2], sys.argv[3]
r = requests.get(
    "https://api.sume.com/v1/videos/models",
    headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
    timeout=30,
)
r.raise_for_status()
hits = []
for m in r.json().get("data") or []:
    if secs not in (m.get("supported_durations") or []):
        continue
    if res not in (m.get("supported_resolutions") or []):
        continue
    if ratio not in (m.get("supported_aspect_ratios") or []):
        continue
    hits.append(m["id"])
print("\n".join(hits) or "none")
sys.exit(0 if hits else 1)

What to do with the result

Run python pick.py 12 1080p 9:16 and you get the ids that list 12 seconds at 1080p in 9:16. Then check each row's other limits in the Video Router docs: references, audio and end frames differ per row. If the output is none, change one constraint at a time; length is usually the first to cut, since many rows stop at 10 or 15 seconds.

Length ceilings that explain most empty results, from the Sume Video Router docs, read 2026-10-13.
RowLongest clip
seedance-2.530 s
wan-3.030 s
kling-315 s
minimax-h3, minimax-h3-max15 s
gemini-omni-flash-1.110 s

A caution on field names

The field names in the script follow the supported_* pattern the docs describe; print one row first with print(r.json()["data"][0]) to confirm the exact keys in your environment before you rely on the filter.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume