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.

3 min readSume
All posts

GET /v1/videos/models returns each model's supported_durations, supported_resolutions and supported_aspect_ratios. Check your request against those lists before you submit and you catch a 2-second or 1:1 request on Gemini Omni Flash 1.1 on your side, instead of in an error.

Per the docs the model takes 3 to 10 seconds at 360p, 720p, 1080p and 4K in 16:9 or 9:16.

Script

import os, requests

H = {"Authorization": "Bearer " + os.environ["SUME_API_KEY"]}
models = requests.get("https://api.sume.com/v1/videos/models", headers=H, timeout=30).json()["data"]
m = next(x for x in models if x["id"] == "gemini-omni-flash-1.1")

def problems(req):
    out = []
    if req["duration"] not in m["supported_durations"]:
        out.append("duration must be one of %s" % m["supported_durations"])
    if req["resolution"] not in m["supported_resolutions"]:
        out.append("resolution must be one of %s" % m["supported_resolutions"])
    if req["aspect_ratio"] not in m["supported_aspect_ratios"]:
        out.append("aspect_ratio must be one of %s" % m["supported_aspect_ratios"])
    return out

print(problems({"duration": 2, "resolution": "480p", "aspect_ratio": "1:1"}))
print(problems({"duration": 5, "resolution": "720p", "aspect_ratio": "9:16"}))

What the two calls print

The first call lists three problems; the second prints an empty list. Take the lists from the live catalog rather than hard-coding them, because catalog data can change.

Cost of skipping it

A bad request is rejected before generation, so the cost of skipping the check is time and noise, not money. A valid request is not free: the cheapest legal Omni job is $0.1125, and a 4K 10 second one is $3.75.

  • Run the check in CI against a fixture of your batch file.
  • Fail the batch on any problem, not just warn.

References and frames

The same catalog row lists supported_input_references and supported_frame_images. For Omni the references are image and video, with no audio, so check "audio_url" in m["supported_input_references"] before you send an audio reference. A model accepts a reference type only if the field lists it.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume