Validate clip length against supported_durations before a Sume submit
Durations differ by model: some start at 2 seconds, some stop at 10, some reach 30. Read supported_durations from the catalog and snap a request in Python.

Each Sume video model lists its allowed clip lengths in supported_durations, in whole seconds, and the lists are different: Seedance 2.0 allows 4 to 15, and the docs show other models with different windows. Validate the requested duration against the catalog entry for the exact model before you submit, or let a 400 tell you after the fact.
Do not hard-code a global range. A product that offers a slider from 5 to 10 seconds will be wrong for some models in both directions.
What the catalog says
The Seedance row is from the docs example response, read 2026-10-07. Other models are read from the live endpoint at run time; do not copy a table of them into your app.
| Model | supported_durations | Source |
|---|---|---|
seedance-2 | 4, 5, 6, ... 15 (whole seconds) | Example response, video generation page |
| Any other model | Read GET /v1/videos/models | Live catalog |
Snap, do not guess
There are three policies when the requested length is not on the list. Reject, with a message naming the allowed lengths. Snap to the nearest allowed value, and show the user. Or choose another model that supports the length. The last one is the best fit when model is sume/auto, which lets Sume select the model.
Whichever you choose, do it on the client before the paid call, and keep the real list close: the catalog changes when models are added or retired, and an old copy gives wrong errors.
A Python snap helper
The helper takes a catalog entry as a dict, so you can feed it the live response. The sample list is the Seedance 2.0 one.
def snap(entry, wanted):
allowed = sorted(entry.get("supported_durations") or [])
if not allowed:
return None
if wanted in allowed:
return wanted
return min(allowed, key=lambda d: (abs(d - wanted), d))
seedance = {"id": "seedance-2", "supported_durations": list(range(4, 16))}
print(snap(seedance, 2))
print(snap(seedance, 8))
print(snap(seedance, 30))
Price follows seconds
Cost scales with the seconds you ask for, so snapping up costs more and snapping down costs less. Show the estimate for the snapped value, not for the number the user typed. The usage ledger records what was reserved and captured per job, so you can reconcile later.
Where to run the check
Run it in two places: the form, so a user sees allowed lengths as soon as they pick a model, and the server, right before the paid call. The server check is the one that matters, because a stale browser tab can still send an old value.
A related check is the resolution list, which the catalog also publishes per model. Validate duration, resolution and aspect ratio together against one entry, then estimate the cost of the exact combination you will send. Three small checks in one function beat three separate 400 responses.
Cache the catalog for a few minutes, not days. A model added or retired changes the list, and the catalog endpoint is cheap to read.
- Whole seconds only;
supported_durationsis a list of integers. - Treat an empty or missing list as "ask the catalog again", not as "anything goes".
- Record the value you actually sent next to the job.
Sources
Related posts
More in Developers
- Validate Wan 3.0 reference limits in Python before submitting
wan-3.0 takes 10 images, 5 videos (15 s total, 16 fps minimum) and 5 audios (15 s total). A short Python check catches an over-limit manifest early.
- verifyWebhook in a fetch handler: four rules, 204 for unknown events
Use @sume-com/sdk verifyWebhook on the raw body, await it, treat false as 401 and answer unknown events with 204. A runnable handler for Workers, Deno and Node.
- waitForJob polls every 2 s: 600 reads in a 20-minute Sume video job
The SDK's waitForJob floor is a 2-second poll and a 20-minute timeout: at most 600 reads per job. The read budget by plan and why next_poll_after_seconds wins.
- Wan 3.0 API request cheat sheet: three modes, 2 to 30 seconds
Wan 3.0 on Sume: the request body for text, first/last frame and reference modes, the 480p/720p/1080p rates and the 2 to 30 second window, on one page.
Written by Sume