Vercel AI Gateway poll intervalMs and timeoutMs vs Sume polling

AI Gateway's poll option sets intervalMs (5000) and timeoutMs (600000). Sume jobs return next_poll_after_seconds, and your client owns the deadline.

4 min readSume
All posts

In the AI SDK with AI Gateway, poll.intervalMs is how often the SDK checks job status (default 5000) and poll.timeoutMs is how long it waits before throwing (default 600000, ten minutes). Sume has no such pair of options: a job response carries next_poll_after_seconds when it has one, and the deadline is a number your own client chooses.

Gateway facts are from Vercel's video generation page; Sume facts from Jobs and results and Generation admission, all read 2026-10-01.

What do intervalMs and timeoutMs do in AI Gateway?

Passing a poll option runs the generation as an AI Gateway job instead of one held-open request. The SDK sends a start request, then checks status until the job finishes, so each network request stays short. Vercel also lists poll.delay, a replacement for the timer between checks, meant for a durable workflow's sleep function.

How does Sume tell a client when to poll again?

Submit with mode: "async" and an Idempotency-Key, then read status_url. The docs say to honor next_poll_after_seconds when it is present and to back off otherwise. The loop shape in the docs ends with sleep(s.next_poll_after_seconds or exponential backoff), and it stops when terminal is true.

Who owns the deadline?

You do. The docs say to keep polling until terminal: true, or until your own application deadline, and not to resubmit a paid request just because a local worker timed out. If you need a Gateway-style timeoutMs, write it as a clock check in your loop and keep the job id so a later process can read the same job.

Polling controls compared, read 2026-10-01.
ControlAI Gateway (video)Sume job API
Intervalpoll.intervalMs, default 5000next_poll_after_seconds when present, else exponential backoff
Deadlinepoll.timeoutMs, default 600000Your application deadline
Timer in a workflowpoll.delay replaces the timerUse your workflow's own sleep in the loop
Many jobsOne startVideo per job, store operationsBack off; avoid tight loops across many jobs

What does a minimal Sume poll loop look like?

The loop below reads the status endpoint named in the docs and enforces a deadline you pick.

const headers = { Authorization: "Bearer " + process.env.SUME_API_KEY };

async function waitForJob(jobId: string, deadlineMs = 600_000) {
  const stop = Date.now() + deadlineMs;
  let backoff = 2;
  while (Date.now() < stop) {
    const res = await fetch("https://api.sume.com/v1/jobs/" + jobId + "/status", { headers });
    const s = await res.json();
    if (s.terminal) return s;
    const wait = s.next_poll_after_seconds ?? backoff;
    backoff = Math.min(backoff * 2, 30);
    await new Promise((r) => setTimeout(r, wait * 1000));
  }
  return null; // your deadline passed; the job is still yours to read later
}

What should I do when my deadline passes?

Do not submit again. Keep the job id, read it later, or cancel it. See poll AI video job status for the status vocabulary.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume