Validate a Gemini Omni Flash 1.1 request in Python before sending
A 28-line Python check for Sume's gemini-omni-flash-1.1 rules: 3-10 s, 10 reference images, 3 reference videos, no audio off, and edit mode exclusions.

Gemini Omni Flash 1.1 (gemini-omni-flash-1.1) on Sume has a handful of rules that you can check before you spend a request: 3 to 10 seconds, resolution from 360p to 4K, aspect ratio 16:9 or 9:16, at most 10 reference images and 3 reference videos, no generate_audio false, and edit mode through video_url that cannot be mixed with the image and reference fields. A local function that returns a list of problems saves a failed call and keeps bad payloads out of your queue.
The rules in one table
Native audio is always on, so the API rejects generate_audio false. The docs also list no bitrate_mode and no reference_audio_urls.
| Capability | Send | Limits |
|---|---|---|
| text_to_video | prompt | 3-10 s, 360p/720p/1080p/4K, 16:9 or 9:16 |
| image_to_video | image_url and optional end_image_url | Same envelope |
| reference_to_video | reference_image_urls and reference_video_urls | Up to 10 images and 3 videos, each video 3 s or less |
| video_to_video (edit) | video_url | No image_url, end_image_url or reference urls. No aspect_ratio or duration. Resolution defaults to 720p |
The check
The function returns an empty list when the body looks valid. It cannot measure the length of a reference video, so keep the 3-second limit on those clips in your upload step. The main block shows an edit request that also carries a duration and generate_audio false.
import json
REF_KEYS = ("reference_image_urls", "reference_video_urls")
EDIT_BLOCKS = ("image_url", "end_image_url", "aspect_ratio", "duration") + REF_KEYS
def check_omni(body):
errs = []
if body.get("generate_audio") is False:
errs.append("generate_audio:false is rejected, audio is always on")
for key in ("bitrate_mode", "reference_audio_urls"):
if key in body:
errs.append(f"{key} is not supported")
if len(body.get("reference_image_urls") or []) > 10:
errs.append("at most 10 reference_image_urls")
if len(body.get("reference_video_urls") or []) > 3:
errs.append("at most 3 reference_video_urls (each 3 s or less)")
if body.get("video_url"):
errs += [f"video_url cannot combine with {k}" for k in EDIT_BLOCKS if body.get(k)]
else:
if body.get("duration") is not None and not 3 <= body["duration"] <= 10:
errs.append("duration must be 3-10 seconds")
if body.get("aspect_ratio") not in (None, "16:9", "9:16"):
errs.append("aspect_ratio must be 16:9 or 9:16")
if body.get("resolution") not in (None, "360p", "720p", "1080p", "4K"):
errs.append("resolution must be 360p, 720p, 1080p or 4K")
return errs
if __name__ == "__main__":
bad = {"prompt": "x", "video_url": "https://example.com/a.mp4", "duration": 5, "generate_audio": False}
print(json.dumps(check_omni(bad), indent=1))
print(check_omni({"prompt": "x", "duration": 8, "resolution": "720p"}))What a pass costs
A passing request still costs money, so size it first. Sume bills the provider list price times 1.25 for each output second. At 720p the provider list is $0.10 a second, so an 8-second clip is 8 x ($0.10 x 1.25) = 8 x $0.125 = $1.00. A 3-second 360p draft is 3 x $0.0375 = $0.1125.
- Run the check at the edge of your service, before the Idempotency-Key is created, so a rejected body never holds a key.
- Keep the rule values in one constant block so a catalog change is a one-line edit.
- Read GET /v1/video-router/models for the live capabilities and let the code trust that over this table.
Sources
Related posts
More in Developers
- A Veo 3.1 call becomes a Sume Omni job in under 30 lines of Python
Replace a Veo 3.1 request with a Sume gemini-omni-flash-1.1 job: submit, poll every 30 seconds, download the mp4 and read usage.cost. Standard library only.
- Veo 3.1 previews end in 14 days: a dated checklist, Oct 8 to Oct 22
Google's three Veo 3.1 preview ids shut down on October 22, 2026. A day-by-day checklist from today, with the Sume model id and limits to test against.
- Vercel 800 s max duration: do you still need a Sume webhook?
Vercel Pro allows 800 s functions and a 30-minute beta. A Sume video job can still outlast one request, so use async or webhook mode and return in seconds.
- Vercel's 300 s default: does a 30 s Sume image sync call fit?
Yes: with fluid compute the default is 300 seconds, far above the 30-second Sume image wait. Branch on 200, 202 and 502, and poll video jobs instead.
Written by Sume