HTTP 429 "Too Many Requests" means the API is rate limiting you: your account sent more requests or tokens in a time window than its limit allows, or it hit a spend cap. Wait for the number of seconds in the retry-after header (or back off exponentially with random jitter) and retry, and if it keeps happening, reduce tokens per request, spread requests out, or move to a higher usage tier.
RFC 6585 defines 429 as "the user has sent too many requests in a given amount of time" and lets servers include a Retry-After header saying how long to wait. LLM providers use it for several different conditions, and the fix depends on which one you hit.
What the 429 error looks like
On the Claude API, every 429 has the error type rate_limit_error. A rate limit and a monthly spend cap look similar, so read the details. This is the spend-cap version as documented by Anthropic:
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "You have reached your API usage limits: your organization has crossed its monthly API usage threshold, ...",
"details": { "error_code": "enforced_spend_limit_reached" }
},
"request_id": "req_018EeWyXxfu5pfWkrYcMdjWG"
}
On the OpenAI API, the documented 429 variants include "Rate limit reached for requests" (you are sending requests too quickly), a rate_limit_error with code slow_down ("Your request rate increased too quickly"), and code credit_balance_exhausted when prepaid credits run out, where the broader error.type can still be insufficient_quota.
Which kind of 429 is it?
| Cause | How to recognise it | Will retrying help? | Fix |
|---|---|---|---|
| Requests per minute | retry-after header present; requests-remaining header at 0 | Yes, after the wait | Spread requests out, queue them, or raise your tier |
| Tokens per minute (input or output) | Tokens-remaining header at or near 0, often with few requests | Yes, after the wait | Send fewer tokens per request, cache repeated context |
Sudden traffic spike (acceleration limit or slow_down) | Appears right after a sharp jump in usage | Yes, if you ramp up gradually | Increase traffic gradually |
| Monthly spend cap (Claude) | enforced_spend_limit_reached, no retry-after | No, until the cap resets or is raised | Request a higher tier or wait for the next month |
| Credits exhausted (OpenAI) | credit_balance_exhausted / insufficient_quota | No | Add credits in billing settings |
The rule of thumb: if there is a retry-after header, it is a temporary limit and waiting works. If the message talks about quota, billing, credits or spend, no amount of retrying will help.
What the limits actually measure
Both providers count more than requests:
- Claude API: requests per minute (RPM), input tokens per minute (ITPM) and output tokens per minute (OTPM), per model class, set by your organization's usage tier. Anthropic uses a token bucket, so capacity refills continuously instead of resetting on the minute. For most current models only uncached input tokens count toward ITPM, so prompt caching raises your effective limit. Output tokens are counted as they are generated;
max_tokensdoes not count against OTPM. - OpenAI API: requests and tokens per minute and per day (RPM, RPD, TPM, TPD), plus images per minute (IPM) for image models. You hit whichever comes first. OpenAI counts the larger of
max_tokensand the estimated token count against your limit, so settingmax_tokensfar above what you need uses up headroom.
As of October 2026, Anthropic's documented Start-tier limits for its main models are 1,000 RPM, 2,000,000 ITPM and 400,000 OTPM; OpenAI moves accounts up its Free, Build, Launch and Grow tiers automatically as total credit purchases reach $5, $100 and $500. Your current limits are on the provider's console page (for Claude, platform.claude.com/usage/limits).
How to read the rate-limit headers
Every response, not only errors, tells you how much headroom is left. Log these and you will see a 429 coming:
| Claude API | OpenAI API | Meaning |
|---|---|---|
retry-after | Retry-After | Seconds to wait before retrying (not on every 429) |
anthropic-ratelimit-requests-remaining | x-ratelimit-remaining-requests | Requests left before you are limited |
anthropic-ratelimit-input-tokens-remaining, -output-tokens-remaining | x-ratelimit-remaining-tokens | Tokens left |
anthropic-ratelimit-requests-reset (RFC 3339 time) | x-ratelimit-reset-requests | When the request limit is fully replenished |
To see them with curl, add -i so headers are printed before the body.
How to retry a 429 correctly
OpenAI's guide says to treat Retry-After as a minimum, add a small random delay, and fall back to exponential backoff with jitter when the header is missing; it also warns that failed requests count toward your per-minute limit. A minimal Python version:
import random
import time
import requests
def post_with_retry(url, headers, payload, max_attempts=6, max_wait=60):
"""POST, retrying 429/5xx with Retry-After or exponential backoff plus jitter."""
for attempt in range(max_attempts):
resp = requests.post(url, headers=headers, json=payload, timeout=120)
if resp.status_code not in (429, 500, 502, 503, 504, 529):
resp.raise_for_status() # other 4xx: a bug in the request, don't retry
return resp.json()
if attempt == max_attempts - 1:
resp.raise_for_status()
retry_after = resp.headers.get("retry-after")
if retry_after is not None:
wait = float(retry_after) # the server told us; treat it as a minimum
else:
wait = min(max_wait, 2 ** attempt) # 1, 2, 4, 8, 16... seconds
wait += random.uniform(0, 1) # jitter so parallel workers don't retry in lockstep
print(f"HTTP {resp.status_code}, retrying in {wait:.1f}s")
time.sleep(wait)
Run against a local test server that answered 429 (with retry-after: 2), then 529, then 200, it printed:
HTTP 429, retrying in 3.0s
HTTP 529, retrying in 2.6s
{'ok': True}
Two caveats. The code assumes retry-after is a number of seconds, which is what both providers document; the HTTP standard also allows a date. And a spend-cap or credits 429 will burn through all attempts and then raise, which is what you want: it needs a human, not a loop. If you use an official SDK, it already retries (Anthropic's SDKs retry twice by default, configurable with max_retries), so wrap your own logic around it rather than duplicating it.
How to stop hitting the limit
- Send fewer tokens. Trim long system prompts and chat history, and cache the fixed part of the prompt. How to reduce AI token usage covers each lever, and the token counter shows how big a prompt is before you send it.
- Cap concurrency. Ten parallel workers each retrying on their own will hammer the limit. Use a queue or a semaphore so only N requests are in flight.
- Ramp up gradually. Both providers mention limits triggered by sharp increases in traffic. Start a large job slowly.
- Use batch processing for work that can wait. Anthropic's Message Batches API has its own separate limits, so moving offline jobs there frees your real-time quota. Batches are also billed at a discount; see how LLM API pricing works.
- Raise your tier. Tiers rise automatically with usage history and account standing (Anthropic) or total credit purchases (OpenAI). On the Claude Console use Request tier increase on the Rate limits page.
If you still get 429 errors
Check which limit is actually being hit by logging the remaining-requests and remaining-tokens headers on successful calls just before the error. If tokens run out first, more requests per minute won't help. If you use workspaces, a lower workspace limit may apply before the organization limit; Anthropic notes the tokens headers show whichever limit is most restrictive. And if the error says spend, quota or credits, stop retrying and fix billing.
Frequently asked questions
- Does retrying a 429 make it worse?
- Retrying immediately and repeatedly does. OpenAI's documentation says unsuccessful requests still count toward your per-minute limit, so a tight retry loop keeps you over it. Wait at least the Retry-After value, or back off exponentially with random jitter, and cap the number of attempts.
- What is the difference between 429 and 529 on the Claude API?
- 429 rate_limit_error means your organization hit one of its own limits: requests, input tokens or output tokens per minute, or a spend cap. 529 overloaded_error means the API is temporarily overloaded across all users. Both are worth retrying with backoff, but only 429 is fixed by changing your own usage or tier.
- Why do I get 429 when I'm far below my requests-per-minute limit?
- Limits can be enforced over shorter windows than a minute, so a burst can trip them. Anthropic gives the example that 60 RPM may be enforced as 1 request per second. Token limits also apply separately, so a few very large prompts can hit the input-token limit with only a handful of requests.
- Do the official SDKs retry 429 automatically?
- Anthropic's SDKs retry transient failures, including rate limits and 5xx errors, twice by default with exponential backoff, honouring retry-after when present; max_retries changes that. Check your SDK's documentation for its default, and do not stack your own aggressive loop on top.