AI API Rate Limits and 429s for Image and Video Jobs
How an AI API rate limit works for image and video jobs: requests a minute versus jobs at once, the headers, Retry-After, and a queue that avoids 429s.
Updated 5 min read
An AI API rate limit caps how fast you can start work, and image and video APIs usually set two: how many requests you may send in a minute, and how many jobs may run at once. On Frameport a workspace may start 60 generations a minute and keep 20 running at the same time; past either, the API answers 429 Too Many Requests with a Retry-After header that says how long to wait.
This guide explains the two limits, the headers that tell you where you stand, how to back off without losing or doubling a job, and a small queue that keeps a batch of hundreds under the limits. The numbers are the same for every workspace and every model.
Two limits: requests a minute and jobs at once
| What is counted | Limit per workspace | Past it | When it frees up |
|---|---|---|---|
| Requests that start work: images, videos, clip edits | 60 a minute | 429 rate_limited | At the start of the next minute |
Uploads (POST /v1/uploads) | 10 a minute | 429 rate_limited | At the start of the next minute |
| Generations open at once (queued or running) | 20 | 429 concurrency_limit | When one of them succeeds or fails |
| Reads, lists, quotes, the models list | Not counted | — | — |
The minute is a fixed window on the clock, not a rolling one: every counted request in the same UTC minute adds to one tally, and the tally starts over when the minute turns. The running limit counts generations, not requests: a clip holds one of your 20 places from the moment it is accepted until it succeeds or fails.
Which one you meet first depends on the job. Short jobs sent in a tight loop, like most image requests, tend to reach the per-minute limit first. Long jobs, like most clips, stay open, so a batch of videos tends to fill the running places before it sends 60 requests. A well-behaved client watches both.
Polling is free in this respect. GET on a generation, the generations list, GET /v1/models and POST /v1/generations/quote are never counted, so checking a job every few seconds or pricing a whole spreadsheet first costs you no headroom.
Reading the rate-limit headers
Every counted request answers with three headers, whether it was accepted or not:
HTTP/1.1 202 Accepted
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 12
X-RateLimit-Reset: 1795776060X-RateLimit-Limit is the workspace's limit, X-RateLimit-Remaining what is left in this minute, and X-RateLimit-Reset when the minute ends, in Unix seconds. A client that reads them can slow down before it hits the wall rather than after. The same numbers come back from GET /v1/account under limits, along with usage.running_generations, so a worker can size its pool at startup instead of hard-coding it (account).
Retry-After and backoff
A refused request holds nothing and charges nothing, and its answer tells you what to do next:
{
"error": {
"code": "concurrency_limit",
"message": "Too many generations are running at once (20 for this workspace). Retry when one finishes.",
"request_id": "req_2Wd8XbLq5mT9vRn1Kc7Y"
}
}rate_limitedcomes withRetry-Afterset to the seconds left in the current minute. Waiting that long is enough.concurrency_limitcomes with a shortRetry-After. Better still, submit the next job when one of yours settles, which your polling loop or a webhook already tells you.- Now and then a model whose queue is full for a moment answers
429below these numbers. Handle it the same way. 503 model_unavailablehas no fixed wait: back off with a growing delay (2, 4, 8 seconds, capped) plus a little random jitter, so that many workers do not retry in step.
Retry with the same Idempotency-Key you sent the first time. If an earlier attempt did get through, the key returns that generation instead of starting a second one. Note that a replayed request still counts toward the minute, so a retry storm can keep you at the limit; the wait matters. The error codes guide has a full retry loop, and the idempotency guide explains the key.
Queue your own jobs
The surest way to avoid 429 is never to ask for more than the limits allow. This script reads the limits once, then lets at most that many jobs run and keeps submits under the per-minute count, however many prompts you give it:
import { randomUUID } from 'node:crypto'
import { setTimeout as sleep } from 'node:timers/promises'
const API = 'https://frameport.ai/v1'
const HEADERS = { 'Authorization': `Bearer ${process.env.FRAMEPORT_API_KEY}`, 'Content-Type': 'application/json' }
const account = await fetch(`${API}/account`, { headers: HEADERS }).then(res => res.json())
const { requests_per_minute: perMinute, concurrent_generations: maxRunning } = account.limits
let running = 0
const recent = [] // when each recent submit was sent
async function takeSlot() {
for (;;) {
const now = Date.now()
while (recent.length && now - recent[0] > 60_000) recent.shift()
if (running < maxRunning && recent.length < perMinute) {
running += 1
recent.push(now)
return
}
await sleep(1000)
}
}
async function runJob(body) {
await takeSlot()
const key = randomUUID()
try {
let gen
for (let attempt = 0; ; attempt++) {
const res = await fetch(`${API}/videos/generations`, {
method: 'POST',
headers: { ...HEADERS, 'Idempotency-Key': key },
body: JSON.stringify(body),
})
gen = await res.json()
if (res.ok) break
if (![429, 503].includes(res.status) || attempt === 5) throw new Error(`${gen.error.code}: ${gen.error.message}`)
await sleep((Number(res.headers.get('retry-after')) || 2 ** attempt) * 1000)
}
while (gen.status === 'queued' || gen.status === 'running') {
await sleep(5000) // reads are not counted
gen = await fetch(`${API}/generations/${gen.id}`, { headers: HEADERS }).then(res => res.json())
}
return gen
}
finally {
running -= 1 // the place is free once the job has settled
}
}
const prompts = ['A lighthouse in a storm, wide shot', 'A fox crossing a frozen lake at dawn', 'Rain on a neon street, slow pan']
const results = await Promise.allSettled(prompts.map(prompt =>
runJob({ model: 'seedance-2-5', prompt, duration: 5, resolution: '480p' })))
for (const result of results) console.log(result.status === 'fulfilled' ? `${result.value.id} ${result.value.status}` : result.reason.message)The client counts a rolling minute, which is stricter than the server's clock minute, so it stays under the limit even across a minute boundary. For a service rather than a script, replace the polling loop with a webhook and free the slot when the delivery arrives; polling or webhooks weighs the two. The rate limits reference has the same rules in short.
Same limits for every workspace and every model
There are no request tiers to buy. Every workspace has the limits above, and they are shared by all its API keys, the Studio and the MCP server: an agent that starts clips and a script that starts images draw from the same minute. A second workspace has its own limits and its own balance, which is a clean way to keep a staging environment from slowing production.
The limits are also the same whatever the model. Nano Banana Pro, GPT Image 2.5 Sunburst and Grok Imagine 2.0 for images, Veo 3.1, Seedance 2.5 and Grok Imagine for video: one counter, one set of headers, one way to handle a 429. A key that leaks spends your limits as well as your balance: see API key security.
FAQ
What is an API rate limit?
A cap on how many requests a client may send in a given time, or how much work it may have open at once. It keeps one caller from crowding out the others. When you pass it, the API refuses the request, usually with status 429, and says when to try again.
What does "rate limit exceeded" mean?
Your workspace sent more requests that start work this minute than it may. The answer is 429 rate_limited with a Retry-After header; nothing was held or charged. Wait that many seconds and send the same request with the same Idempotency-Key.
Is there a separate rate limit for Nano Banana Pro or Veo 3.1?
No. Limits belong to the workspace, not to the model: 60 requests that start work a minute and 20 generations running at once, across every model you call.
Does polling count against the rate limit?
No. Reading a generation, listing generations, listing models and quoting a request are never counted. Poll every few seconds rather than in a tight loop, which helps no one, or let a webhook tell you when a job settles.
How do I avoid 429 errors in a batch?
Queue the jobs on your side: keep at most 20 running, send no more than 60 a minute, and start the next one when one settles. Read the limits from GET /v1/account so your code follows them without hard-coded numbers.