An LLM API returns HTTP 429 when you have sent too many requests in a given time, and the quickest way to fix it is to find out which limit you hit, because the cure for each is different. On this gateway a 429 comes from model-provider load, a limit you set on a key, the daily free allowance or an account spend cap, and only the first two are worth retrying in a loop.
What does a 429 error mean?
A 429 means the client has sent too many requests in a given amount of time, and servers may add a Retry-After header to say how long to wait. That is the definition on MDN’s 429 page, which also notes that limits may be server-wide or per resource and are often tied to a client’s IP, or to a user or application when requests are authenticated. The status itself comes from RFC 6585, and nothing in it says what is being counted. That is why LLM APIs, which count requests, input tokens, output tokens, daily totals and money, all use the same number for very different problems.
Our error reference puts it in one line: a 429 means slow down, not stop. That is true for the common case and false for a few. A daily cap does not clear by waiting a few seconds. A spend cap does not clear until a window resets. Anthropic’s rate limit page shows the extreme case: when an organization crosses its monthly spend cap the API returns a 429 with no retry-after header, and the page says that retrying, including the SDK’s automatic retries, fails until access resumes. A retry loop that assumes every 429 is temporary will hammer a closed door.
The Retry-After header is simpler than it looks. MDN’s Retry-After page lists two forms, a number of seconds or an HTTP date, and warns that client and server support for the header is still inconsistent. On this gateway it is always seconds, and it is sent on a 429 from a daily cap, a key limit or a spend limit, as the headers reference lists. A provider’s own 429 may or may not include it, so your code needs a fallback delay for the no-header case.
Where does a 429 come from on this gateway?
It comes from one of three places: the model’s provider, a limit you configured, or a daily or spend cap. The rate limits page says the gateway never caps requests per minute on its own. What limits usage is your balance and each key’s spend limit, plus the ceilings you add on purpose. The table lists every 429 you can see, who sets it, and whether waiting helps.
| What you see | Who sets it | What it means | Does waiting help? |
|---|---|---|---|
No code, a provider message |
The model’s provider | The model is busy and the provider throttled the call | Yes, with backoff |
| “Rate limit reached: at most N requests per M minutes” | A per-model limit, off by default | The numbers in the message are the exact limit | Yes, after the window |
key_rate_limit |
You, on the key | The key’s requests per minute is used | Yes, Retry-After says how long |
key_daily_budget |
You, on the key | The key’s spend budget (daily, weekly or monthly, UTC) is used | Only until the reset; or raise it |
key_budget_blocked |
You, on the key | A key set to block at its budget is blocked | No, unblock it in the console |
end_user_budget |
You, on the key | One of your end users reached their spend limit | Yes, Retry-After says when |
account_spend_cap |
You, in Settings | The account cap per day, week or month is reached; free models still answer | Only until the reset |
daily_limit_free |
The free lane | 100 requests or 3,000,000 tokens a day used | No, until 00:00 UTC (05:30 IST) |
Two points about that table. First, the provider row is the one that your retry loop is for. The errors page calls it the usual source, and says provider 429s pass through with the provider’s message. Second, almost every other row is a limit you can change. If you are hitting key_rate_limit or key_daily_budget, you set that number, and the fix is to raise it under Keys, not to retry harder. Coupon errors exist too, but only appear if a request names a code in X-Coupon, and they are listed in the coupon error table.
One more thing happens before you see a provider 429. When the provider fails before sending any part of the answer, the gateway first retries the model you named, up to twice. If the model is still failing, fallback rules, presets and automatic routing switch the request to another similar model, and the free lane also retries a failing :free call on another model by itself. Only the attempt that answers is billed, and an X-Fallback-From header on the reply names the model that failed. So an error that reaches your code has already survived those retries and that switch. The routing and privacy page has the rules, including that an error after the answer started streaming is passed on as it is. Because the answering model can differ from the one you named, the six checks for verifying the model are worth running once on any route you depend on.
Which 429 did you get?
Pick the code you saw. The panel says what it means and what to do next. It does not send anything anywhere.
What did the 429 response say?
daily_limit_free
Retry-After. Retrying sooner does not help. Free ids work with a $0 balance, so there is nothing to top up: wait for the refill, or move the work to a priced model from your balance when one is available. The error reference has the exact wording.key_rate_limit
Retry-After, lower your concurrency, or raise the limit. The x-ratelimit-remaining-requests header tells you how close you are before the next 429.key_daily_budget or key_budget_blocked
key_daily_budget resets daily, weekly or monthly in UTC and sends Retry-After. key_budget_blocked means the key is set to block at its budget and stays blocked until you unblock it in the console, so retrying is pointless. Either raise the budget or wait for the reset. See cost control.end_user_budget
user field or metadata.user_id on the request, reached the spend limit you set per user. Retry-After says when they can send again. Other users on the same key are not affected. The limits section explains the setting.account_spend_cap
Retry-After counts down to the reset. The request that crosses the cap still finishes, so the total can end slightly above it. Change the cap under Settings, or see cost control.No code, or a provider message
X-Fallback-Models or switch to a sibling. The status page shows whether other people see the same model failing.How do other platforms count their limits?
They count different things, which is why a number from one provider tells you little about another. The table sums up what four of them print on their own pages, read on 26 November 2026.
| Platform | What is counted | How it resets | 429 details |
|---|---|---|---|
| OpenAI | Requests, tokens and images per minute, plus daily limits; whichever hits first | Per window; set at organization and project level | Retry-After when present; a hard spend limit also returns 429 |
| Anthropic | Requests, input tokens and output tokens per minute, per organization | Token bucket, refilled continuously | retry-after when present; spend cap 429 has none |
| Groq | Requests and tokens, per minute and per day, per organization | Per window | retry-after set only when a 429 is returned |
| OpenRouter | Free models: 20 requests a minute, 50 or 1,000 a day; credit errors are 402 | Daily (UTC) for free models | Failed attempts count toward the free cap |
| One AI API Key | No default request cap; optional key and model limits; free lane 100 requests a day | Daily at 00:00 UTC for the free lane | Retry-After in seconds on key, daily and spend caps |
Three things in that table change how you write code. Whichever-comes-first limits (OpenAI and Groq both say so) mean 20 tiny requests can use a requests-per-minute limit that your token count never approached. Token buckets, which Anthropic’s page describes as capacity continuously replenished up to a maximum, mean a burst can be refused even when your average is fine: the page says a rate of 60 requests a minute might be enforced as one a second. And OpenRouter’s page notes that making additional accounts or keys does not affect its rate limits, since it governs capacity globally. Spreading across keys is not a way around provider limits, and we would not suggest it.
Caching helps here too. Anthropic’s page says its default input-token limits count only uncached input tokens, and Groq’s says cached tokens do not count toward its limits. If your 429s are token limits on a long prompt, a stable prefix reduces them twice over, once on the bill and once on the limit. The cost-cutting guide and our prompt caching page show how.
Counting matters on resellers too. The research on cheap LLM API resellers found relays reporting thousands more input tokens than the official API for identical requests, which would also use up a token limit faster. If you are choosing between gateways partly on how they behave under limits, seven gateways compared lines them up, self-hosting a LiteLLM proxy against a hosted gateway shows what changes when the retries and limits become yours to run, and credit fees, markup and BYOK shows what each one adds on top of token prices.
How long should you wait between retries?
Wait for Retry-After when you have it, and otherwise back off exponentially with jitter. Exponential backoff means each wait is about double the one before it, up to a cap. Jitter means each wait is multiplied by a random factor so a crowd of clients does not retry in lockstep.
The jitter part is not decoration. Marc Brooker’s AWS Architecture Blog post simulates many clients contending for one resource and finds that plain exponential backoff leaves clusters of calls at the same moments. Adding jitter spread them out, and with 100 contending clients it cut the number of calls by more than half and finished sooner. It calls the no-jitter version the clear loser and recommends jittered backoff as a standard approach for remote clients. A retry loop that sleeps exactly 1, 2, 4, 8 seconds across 50 workers sends 50 requests at each of those moments. The same loop with jitter spreads them across each interval.
Our own rate limits guide uses 1, 2, 4 and 8 seconds with random jitter and gives up after about five tries. The calculator lets you try other numbers. The default base is one second and the cap is 30, with five retries, so the worst case is 31 seconds of waiting, and about half of that on average if you use full jitter. A set Retry-After overrides the schedule.
Backoff schedule
- Wait before retry 1, at most
- 1.00
- seconds
- Wait before retry 2, at most
- 2.00
- Wait before retry 3, at most
- 4.00
- Wait before retry 4, at most
- 8.00
- Wait before retry 5, at most
- 16.00
- Worst-case total wait, seconds
- 31.00
- Expected total with full jitter, seconds
- 15.50
Full jitter sleeps a random time between zero and the ceiling shown. A Retry-After value replaces every wait. Runs in your browser; nothing is sent.
The point of the second figure is to be realistic about what backoff buys. Five retries is about half a minute of patience. That is enough for a provider that is briefly overloaded and useless for a daily cap, which is why the first job of a retry loop is to recognise the cases it should not retry.
How many requests can you run at once?
At most as many workers as your limit allows for your average latency, and our guide’s suggestion is to start near eight and raise it while errors stay rare. A simple relationship connects the two: the request rate you create is the number of workers divided by the average time one request takes. Eight workers with a six-second average request rate send about 80 requests a minute, which is over a 60-per-minute key limit before any retry happens.
Workers against a requests-per-minute limit
- Requests per minute you will send
- 80.00
- Most workers that fit under the limit
- 6
- Verdict
- Over by 20 requests a minute
Assumes each worker sends the next request as soon as the last one ends. Streaming and long replies raise the average latency, which lowers the rate. Token limits need a separate check.
If you only have the free lane, the limit that bites is the day, not the minute. 100 requests and 3,000,000 tokens a day means an average of up to 30,000 tokens per request before the token side binds, so the request count runs out first on any ordinary workload. A script that fires 300 short calls will hit daily_limit_free after the hundredth, whatever its concurrency. The free tier comparison has a calculator for that.
Why do retries multiply?
Because every layer that retries multiplies the layers above it. The official OpenAI and Anthropic SDKs already retry connection errors, 429s and 5xx errors twice with backoff, which the rate limits page calls out. If you wrap your own five-attempt loop around an SDK that retries twice, one failing call becomes 15 requests. The gateway adds up to two retries of its own when a provider fails before answering, so in the worst case, each of those 15 can become three attempts at the provider.
Requests one failing call can turn into
- No retries1
- SDK default (2 retries)3
- SDK with max_retries set to 56
- Own 5-try loop around the SDK default15
- Same, with 2 gateway retries eachup to 45only when the provider is the one throttling
During a real provider overload, 45 attempts per call is exactly the wrong thing to add. Google’s SRE chapter on handling overload describes the goal as building clients and backends that handle resource restrictions gracefully, and it notes that a service under overload should deliver errors to misbehaving customers while others remain unaffected. A client that backs off is a well-behaved customer in that sense. The fix on our side is the one our own docs give: raise max_retries for batch work rather than wrapping a second loop, and keep one retry policy in one place.
What does a retry-aware client look like?
It reads the status, the code and the header, and it knows which codes to stop on. The code below is deliberately different from the hand-written loop on our errors page: it uses full jitter, honours Retry-After, stops on the codes that waiting cannot fix, and refuses to sleep for more than two minutes in-process, because a long wait belongs in a scheduler, not a blocked thread. It reads the key from the ONEAIAPIKEY_API_KEY environment variable.
import os, random, time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.oneaiapikey.com/v1", api_key=os.environ["ONEAIAPIKEY_API_KEY"], max_retries=0) # this code owns the retries
STOP_CODES = {"key_budget_blocked", "daily_limit_free"} # waiting will not fix these soon: raise or schedule instead
def error_code(e):
try:
return (e.response.json().get("error") or {}).get("code") or ""
except Exception:
return ""
def delay(e, attempt):
hint = e.response.headers.get("retry-after", "")
if hint.isdigit():
return int(hint) # the server said exactly how long
return random.uniform(0, min(30, 2 ** attempt)) # no hint: full jitter, capped at 30 s
def chat(attempts=6, max_wait=120, **kwargs):
for attempt in range(attempts):
try:
return client.chat.completions.create(**kwargs)
except RateLimitError as e: # HTTP 429 only; other errors are not retried here
code, wait = error_code(e), delay(e, attempt)
if code in STOP_CODES or wait > max_wait or attempt == attempts - 1:
raise # surface it with the request id in the message
print(f"429 {code or 'provider'}: sleeping {wait:.1f}s (request id {e.response.headers.get('x-request-id')})")
time.sleep(wait)
reply = chat(model="z-ai-glm-5.3:free", max_tokens=100, messages=[{"role": "user", "content": "Say hi."}])const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const STOP_CODES = new Set(["key_budget_blocked", "daily_limit_free"]);
export async function chat(body, { attempts = 6, maxWait = 120 } = {}) {
for (let i = 0; i < attempts; i++) {
const res = await fetch("https://api.oneaiapikey.com/v1/chat/completions", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.ONEAIAPIKEY_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (res.ok) return res.json();
const id = res.headers.get("x-request-id");
if (res.status !== 429) throw new Error("HTTP " + res.status + " (request id " + id + ")");
const err = await res.json().catch(() => ({}));
const code = (err.error && err.error.code) || "";
const hint = Number(res.headers.get("retry-after"));
const wait = hint > 0 ? hint : Math.random() * Math.min(30, 2 ** i); // full jitter, capped at 30 s
if (STOP_CODES.has(code) || wait > maxWait || i === attempts - 1) {
throw new Error("429 " + (code || "provider") + " (request id " + id + ")");
}
await sleep(wait * 1000);
}
}Run the SDK with max_retries=0 when you do this, as the Python version does, so only one layer retries. If you would rather not write any of it, the SDK’s own retries with a higher max_retries are fine for most batch jobs. What you cannot get from an SDK alone is the decision to stop on daily_limit_free.
To see what a limit is telling you before it fires, print the headers once. The curl command below shows the request id, and on models and keys that have limits, the remaining counts and the reset time. Daily-capped models send X-Daily-Limit, X-Daily-Remaining and X-Daily-Reset (Unix seconds), and keys with a requests-per-minute limit send the x-ratelimit-* family, as the headers reference lists.
export ONEAIAPIKEY_API_KEY="paste-your-key-here"
curl -sS -D - -o /dev/null https://api.oneaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "z-ai-glm-5.3:free", "max_tokens": 5, "messages": [{"role": "user", "content": "Hi"}]}'
# Look for: X-Request-Id, X-Daily-Limit, X-Daily-Remaining, X-Daily-Reset (models with a daily cap),
# x-ratelimit-* (a key with a requests-per-minute limit), Retry-After (only on a 429).Reading X-Daily-Remaining in a batch job lets you slow down or stop before you hit the wall, which is better than discovering it as a 429 in the middle of a run.
What is the order of operations for a 429?
The diagram shows the order we would put in a client. Each step is cheap, and the later ones only matter when the earlier ones fail.
From a 429 to the right action
What if the 429 will not go away today?
If it is the daily cap, you have three honest options: wait for 00:00 UTC, move that workload to a model that bills from your balance (check the model’s page first: on 26 November 2026 every priced id is marked unavailable), or cut how much you send. Free ids work with a $0 balance and keep working after the sign-up credit is spent, so the daily allowance is the only thing you can run out of on them. The free lane is built for testing, and the 47 free ids share one allowance, so switching between them does not add requests. Priced models are not capped by that counter. They draw on your balance and your key limits instead, and the pricing page shows how credit is added. We are open that online checkout is not open yet: credit is added by email, from $1, with no fee. The guide to prepaid credits explains how a balance, a reserved estimate and a cap interact, and the browser chat guide shows the same allowance from the chat side, where a script’s 100 requests leave the chat nothing for the day.
If it is a provider throttling one model for minutes at a time, the gateway has already retried it and, where fallback rules, presets or automatic routing are set, moved the request to a similar model. You can add to that by naming fallback models in a header, or pick a sibling in the console under Models and Routing, as the uptime guide explains. Every model shares the same API, so a switch is one string. The model list and the comparison page help pick a replacement, and the per-million rates of cheap open models show what a cheaper sibling costs. The status page shows what the gateway’s own probe sees.
If it is a limit you set, change the limit. Spend caps are a feature, not a fault: they are what stops a loop from emptying a balance, and our post on one key per project with spend limits shows how to size them. A 429 from key_daily_budget at 3 p.m. is the system doing its job.
How do you stop causing 429s in the first place?
You send fewer, smaller and better-spread requests, and you watch the headers. Four habits cover most cases.
- Use a queue with a fixed worker count. Do not start a thousand requests at once. A semaphore of eight workers is in the Python and Node examples on the rate limits page, and it is the most reliable pattern for batch jobs.
- Spread work out. If a job can run over an hour, do not run it in one minute. Per-minute limits reward smooth traffic and punish bursts, and a token bucket forgives a small burst and not a large one.
- Cache what repeats. Fewer uncached tokens means fewer token-limit hits on providers that count only uncached input, and a smaller bill on every provider. See the cost-cutting guide.
- Read the remaining counts. If
X-Daily-Remainingorx-ratelimit-remaining-requestsis near zero, slow down before the next call, not after the refusal.
Agents deserve a note. A coding agent can send hundreds of requests with a long history each time, and tools differ in how they retry. The coding agent key guide and the post on choosing a model for coding agents cover per-tool setup, and a spend limit on the agent’s key is the backstop. Streaming matters for the same reason: a long reply that is not streamed can be cut off by a proxy and retried, and the retry pays again, as the streaming guide and the errors page explain.
Is a 429 on a free API different from a 429 on a paid one?
The status is the same and the cause is usually different. On a free tier, the cap is the product: OpenRouter’s free models allow 20 requests a minute and 50 a day, or 1,000 a day once you have bought at least $10 of credit, and failed attempts count towards that cap, according to its limits page. Groq’s published base limits for its gpt-oss models and Qwen3.8 27B are 30 requests a minute and 1,000 a day, with token limits on top, per its rate limits page. On a paid tier, a 429 is more often provider load or a limit you chose. The practical difference is retries: on a free tier a failed retry can spend your allowance, so retry less. Our comparison of free tiers puts the published numbers next to ours, and the guide to the free models says which ids to start with. If you are coming from OpenRouter, where a negative balance blocks free models with a 402 and failed attempts count toward the cap, the migration guide maps the base URL, keys and model ids; here, free ids need no balance at all.
If you are weighing providers partly on how they behave under limits, the 12-point checklist includes limits and error handling, and the gateway explainer shows where a gateway sits relative to the providers that are doing the throttling.
What do we promise about limits, and what not?
We promise that the rules are written down. The gateway sets no default request cap, the optional caps carry a code, and the daily free allowance is 100 requests and 3,000,000 tokens per account, refilling at 00:00 UTC. We do not promise that a provider will never throttle a model, that a free model will stay on the list, or any uptime figure: the terms say so plainly and the transparency page lists what we monitor. If a 429 looks wrong to you, send the request id to support@oneaiapikey.com. We look up the usage record for that id, which holds the time, model, key name, token counts, cost and duration and never your prompt or answer, as the guide to what a gateway sees and stores explains. A new account gets $10 of sign-up credit and 47 free ids, enough to reproduce most of what this post describes without spending anything.
One policy note, since limits and money overlap: once a key is created and usage is consumed we do not give money back, but if a key does not work or something on our side breaks, write to somdutt777@gmail.com and support will look at it. The post on how to read a provider’s money-back terms shows what to check before you pay. For the full picture of what you get and what you do not, read the honest review of One AI API Key.
Hit a 429 on purpose, on a free key
$10 sign-up credit, 47 free models sharing 100 requests and 3,000,000 tokens a day, no card.
Frequently asked questions
What does a 429 error mean in an LLM API?
code in the body before deciding to retry. The error reference lists every 429 code this gateway uses.Should I always retry a 429?
Retry-After header tells you how long, and a 429 from a key set to block at its budget (key_budget_blocked) will not clear until you unblock it in the console.How long should I wait before retrying?
Retry-After says when it is present. Without it, back off exponentially with jitter: about 1, 2, 4, 8 and 16 seconds, each multiplied by a random factor, capped near 30 seconds, and give up after about five tries. The calculator above shows the schedule for your own base and cap, and the rate limits guide has the same advice in one table.Why do I get 429s on a free model?
daily_limit_free until 00:00 UTC (05:30 IST). That allowance is the only limit on them: free ids work with a $0 balance, with no top-up and no card, and they keep working after the sign-up credit is spent. Providers can also throttle a busy model, and the free lane then retries a failing :free call on another model by itself. The free tier comparison puts that allowance next to other providers' daily limits, and the browser chat guide shows how the chat shares the same counter.Does the gateway set its own per-minute request limit?
key_rate_limit, and a per-model limit can be switched on if a model needs protecting.Can a fallback model fix a 429?
X-Fallback-Models header, and an X-Fallback-From header on the reply says which model failed. Only the attempt that answers is billed. A fallback cannot fix a limit you set yourself, such as a key limit or a spend cap. The uptime and fallbacks guide covers when a chain helps, and the six checks for a real model help you confirm which model answered.Will more API keys or accounts raise my limit?
What should I send support about a 429?
X-Request-Id header or the end of the error message, the time with timezone, the model id, the status and the full message, and the last four characters of the key. Never send the whole key. The error reference explains where each of these comes from.