Omni Flash edit in sync mode: it waits 30 seconds, then you poll

Sync mode on Sume waits at most 30 seconds. An Omni edit may not finish in that time, so read the job id from the reply and poll it. Never resubmit.

5 min readSume
All posts

If you send an Omni edit with mode: "sync", Sume holds the request for at most 30 seconds, wait_timeout_seconds max, and then returns the job envelope whether the job is done or not. The docs say what to do when it is not terminal: poll, and do not resubmit. A second submit is a second paid job, unless you reuse the same Idempotency-Key.

What each mode returns

The 30 seconds is a wait budget and not a job duration. Video work can run longer, and the wait can be shorter when waiter capacity is not there. So write the client to accept either outcome: a finished job in the first reply, or an unfinished one with a status URL.

Communication modes for a video submit (read 2026-10-13)
ModeFirst replyNext step
async202 with the job envelopePoll until terminal is true
syncSame envelope after up to 30 sTerminal: read it. Otherwise poll; do not resubmit
webhook202; Sume stores the callbackVerify the signature; keep polling as a backup

A client that polls

The sample submits an edit in sync mode and polls if needed. It reads the envelope defensively, because I did not confirm every key name against a live response, and it sends one fixed Idempotency-Key so a retry cannot make a second job.

import json, os, time, urllib.request

BASE = "https://api.sume.com"
H = {"Authorization": f"Bearer {os.environ['SUME_API_KEY']}",
     "Content-Type": "application/json"}

def call(url, body=None, extra=None):
    req = urllib.request.Request(url, headers={**H, **(extra or {})},
        data=json.dumps(body).encode() if body else None)
    with urllib.request.urlopen(req, timeout=60) as r:
        return json.load(r)

body = {"model": "gemini-omni-flash-1.1", "mode": "sync",
        "prompt": "Replace the bottle with an apple. Keep everything else the same.",
        "video_url": "https://example.com/clip.mp4", "resolution": "720p"}
env = call(f"{BASE}/v1/video-router/generate", body,
           {"Idempotency-Key": "edit-demo-001"})
job = env.get("job", env)
status_url = job.get("status_url") or f"{BASE}/v1/jobs/{job['id']}/status"
while not job.get("terminal"):
    time.sleep(5)
    job = call(status_url)
    job = job.get("job", job)
print(job.get("status"), job.get("result_url"))

Before production

Add a deadline to the loop for production, and read result_url only when result_ready is true. If the process dies mid-wait, restart it with the job id from your logs and poll that job; never POST the edit again.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume