Python pre-flight for a Short: catch Timeline schema errors offline
A Python check for a Sume Timeline body: even width and height, allowed fps, 1 to 1800 seconds, fade limits and start order. Run it before the plan call.

Most Timeline 400s for short-form video come from a handful of rules you can check locally: width and height even and between 256 and 2160, fps one of 24, 25, 30 or 60, duration_seconds from 1 to 1800, fades of 0 to 5 seconds that fit, and video[0].start equal to 0 with strictly increasing starts. The script below checks those rules, taken from the Sume Timeline docs on 2026-10-06. It does not replace the server: the unbilled plan call is the authority.
What does the check look like?
def check(body):
errs, out = [], body.get("output", {})
a, v = body.get("audio", {}), body.get("video", [])
for k in ("width", "height"):
n = out.get(k)
if n is not None and not (isinstance(n, int) and 256 <= n <= 2160 and n % 2 == 0):
errs.append(k + " must be an even integer 256-2160")
if not 1 <= a.get("duration_seconds", 0) <= 1800:
errs.append("duration_seconds must be 1-1800")
if not 1 <= len(v) <= 200:
errs.append("video needs 1-200 slots")
if v and v[0].get("start") != 0:
errs.append("video[0].start must be 0")
if any(y["start"] <= x["start"] for x, y in zip(v, v[1:])):
errs.append("starts must increase")
if out.get("fps", 30) not in (24, 25, 30, 60):
errs.append("fps must be 24, 25, 30 or 60")
fi, fo = out.get("fade_in_seconds", 0), out.get("fade_out_seconds", 0)
if not (0 <= fi <= 5 and 0 <= fo <= 5 and fi + fo <= a.get("duration_seconds", 0)):
errs.append("fades must be 0-5 s and fit")
return errsWhat does it not cover?
Host rules (every URL must be a media.sume.com artifact of your workspace), transition fit and source lengths need the server. Those surface from the plan call or as warnings in the result, so run the plan call after this check and before the paid render.
Sources
Related posts
More in Developers
- Python: run one prompt on four AI video models and save the clips
A Python script that sends one prompt to Wan 3.0, Seedance 2.5, Kling 3 and MiniMax H3 on Sume, polls all four jobs and saves each MP4, with costs.
- Python TTS cost calculator: Sume job rounding vs per-character rates
A runnable Python function that prices narration lines on Sume (cent rounding, 1-cent minimum) and at flat per-million rates for MAI-Voice-2.1 and Flash.
- Python urllib timeout vs Sume's 30 second sync wait
A client read timeout shorter than Sume's sync wait fails before the server answers. A tested demo of the timeout behavior and how to pick a margin above 30 s.
- 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.
Written by Sume