What a Claude API 429 means
Anthropic documents 429 rate_limit_error as: your organization has hit a rate limit, reached its usage tier's monthly spend cap, or reached a spend limit on the Claude Code workspace.1 One status code, three causes, and they need opposite responses. Waiting fixes the first. Nothing but a higher tier or the next month fixes the second.
Before changing any code, read three things from the failed response:
- Is there a
retry-afterheader? A rate-limit 429 can carry one, and Anthropic says to wait that many seconds before retrying.2 A tier spend-cap 429 has noretry-afterheader and keeps failing until access resumes.1 - What is
error.details.error_code? On the Messages API, the spend-cap response addsenforced_spend_limit_reached.2 Anthropic's guidance is to check the error code to tell the spend cap from a rate limit.1 - What does the message say? For a rate limit, Anthropic says the 429 describes which limit was exceeded: requests, input tokens or output tokens.2
A related trap: a spend limit you set yourself, below your tier's cap, does not return a 429. Anthropic returns HTTP 400 with invalid_request_error, and the message starts with "You have reached your specified API usage limits".2 Code that treats every 429 as a rate limit and every 400 as a bad request gets both wrong.
| Response | Cause | Wait and retry? |
|---|---|---|
429, retry-after present | Requests, input-token or output-token limit | Yes, for that many seconds |
429, no retry-after, enforced_spend_limit_reached | Tier's monthly spend cap | No |
| 429 on a sharp usage increase | Ramp limit | Yes, then ramp up more gradually |
| 400, "specified API usage limits" | A spend limit you set | No, raise or remove the limit |
529 overloaded_error | Anthropic overloaded for everyone | Briefly, then fail over |
RPM, ITPM and OTPM: three separate limits
Anthropic measures Messages API rate limits in requests per minute (RPM), input tokens per minute (ITPM) and output tokens per minute (OTPM), for each model class.2 If you exceed any one of them you get the 429. A workload with many small calls runs out of RPM first. A workload that sends long documents runs out of ITPM. A workload that asks for long generations runs out of OTPM, and the other two can look healthy while it does.
Two details change how you size things:
- Limits are per model class and per tier. Each row in Anthropic's tables has its own RPM, ITPM and OTPM, and some rows cover several models that share one limit.2 As one example, the Start tier row for Claude Fable 5.2 lists 4,000 RPM, 500,000 ITPM and 100,000 OTPM.2 Read your own numbers on the Rate limits page of the Claude Console rather than from a blog post, because they change with your tier and with the table.
- Limits are a token bucket, not a reset clock. Capacity is continuously replenished up to your maximum, rather than reset at fixed intervals.2 A short burst can drain the bucket even when the per-minute average is fine; Anthropic's own example is that 60 RPM might be enforced as one request per second.2
Anthropic also says the limits are maximums, not guaranteed minimums.2 Do not plan capacity as if you were always able to use 100% of them.
Output counting has one useful property. OTPM is evaluated as output tokens are produced and counts only tokens actually generated; max_tokens does not factor in, so a high max_tokens has no rate-limit downside.2 ITPM works differently, as the next section shows.
How cached input counts toward ITPM
Anthropic's default ITPM limits count only uncached input tokens.2 The page spells out three fields:
| Usage field | Counts toward ITPM? |
|---|---|
input_tokens (tokens after the last cache breakpoint) | Yes |
cache_creation_input_tokens (tokens written to cache) | Yes |
cache_read_input_tokens (tokens read from cache) | No |
Two consequences. First, input_tokens is only the part after your last cache breakpoint, so total input is cache_read_input_tokens + cache_creation_input_tokens + input_tokens; a 200k-token cached document with a 50-token question reports input_tokens: 50.2 Second, cache writes are not free against the limit. A prompt whose prefix changes on every request keeps paying cache_creation_input_tokens and never gets the benefit of reads.
Anthropic's worked example: with a 2,000,000 ITPM limit and an 80 percent cache hit rate, you could process 10,000,000 total input tokens per minute, because cached tokens do not count toward the limit.2 That is often the lightest way out of an ITPM 429, because it needs no new account and no second provider. Cache system prompts, tool definitions, large context documents and conversation history, and watch your cache hit rate on the Usage page of the Console.2
Also note that ITPM is estimated at the start of each request and adjusted during it to the actual number of input tokens.2 A request can therefore be refused on its estimate, so a single very large prompt can trip the limit even when your running average is low.
retry-after and the rate-limit headers
For retries, Anthropic's SDKs follow two headers. If the response has x-should-retry (true or false), the SDK follows it; otherwise it retries connection errors, timeouts and statuses 408, 409, 429 and 500 and above. If the response has retry-after, the SDK waits as long as the header says; otherwise it uses exponential backoff from 0.5 to 8 seconds. By default it retries twice, for three attempts in all.1 Without the SDK, Anthropic says to follow x-should-retry and retry-after in your own code, with backoff and a retry limit.1
Two warnings about those defaults. The SDK's automatic retries fail against a spend-cap 429 until access resumes, so a spend-cap response burns three attempts for nothing.2 And retries against a limit you are already over add to the load; they do not help you get under it.
Your standing against each limit is on the responses themselves. INFRO's 529 guide lists them as anthropic-ratelimit-requests-*, anthropic-ratelimit-tokens-*, anthropic-ratelimit-input-tokens-* and anthropic-ratelimit-output-tokens-* headers, each with limit, remaining and reset.3 Confirm the exact set on a live response from your account. A small reader turns them into a log line that names the limit that is closest to empty:
import anthropic
client = anthropic.Anthropic(max_retries=0) # decide retries yourself
def limit_report(headers) -> dict:
"""Pick out Anthropic's rate-limit headers from a response."""
return {k: v for k, v in headers.items() if k.startswith("anthropic-ratelimit-")}
try:
client.messages.create(
model="claude-sonnet-5-5",
max_tokens=512,
messages=[{"role": "user", "content": "ping"}],
)
except anthropic.EnforcedSpendLimitReachedError as e:
# Narrow case first: 429 with enforced_spend_limit_reached. Do not retry.
print("spend cap:", e.api_message, e.request_id)
except anthropic.RateLimitError as e:
wait = e.response.headers.get("retry-after")
print("rate limit, retry-after:", wait, limit_report(e.response.headers))The narrow EnforcedSpendLimitReachedError branch must come first, because RateLimitError also catches it.4
Tiers and spend limits as Anthropic describes them
Limits are defined by usage tier, and organizations are placed on a tier automatically from usage history and account standing, moving up over time.2 New organizations or those with limited history may start in an Evaluation tier with limits below the standard ones; those increase automatically as history builds.2 The tiers named on the page are Start, Build, Scale and Custom. You can see your tier and current limits on the Rate limits page of the Console.2
Spend limits are separate from rate limits. Start, Build and Scale each carry a monthly spend cap: $500, $1,000 and $200,000 USD respectively, and Custom organizations have no monthly cap, with limits arranged with their account team.2 At the cap, usage pauses until 00:00 UTC on the first day of the next month unless you request a higher limit sooner, and requests return the 429 described above.2 You can set your own limit below the cap, but never above it.2
Four other facts help with diagnosis:
- Limits are enforced at the organization level, and you can also set user-configurable limits on workspaces.2
- Rate limits are shared across all
inference_geovalues, sousandglobalrequests draw from one pool.2 - Limits on the Claude Code workspace are checked separately, and those requests can get a 429 with a
retry-afterheader.2 - A sharp increase in usage can cause a 429 even while you are under your limits.1 If a new feature launches and the very first minute fails, ramp traffic up instead of switching it on at once.
429 rate_limit_error vs 529 overloaded_error
The two are easy to confuse in a retry loop. A 529 overloaded_error means the API is temporarily overloaded; Anthropic says it can occur when the API experiences high traffic across all users.1 It says nothing about your organization. A 429 is about your organization's limits or spend cap.
That decides the response. For a 529, retry once after a short jittered wait and then send the request elsewhere; INFRO's 529 guide (opens in a new tab) covers that, including the case where the overload arrives as an error event after a streaming 200.3 For a 429, the question is which limit: waiting, caching, a smaller model or more capacity answers each differently. A 529 is never fixed by raising your tier, and a 429 spend cap is never fixed by waiting for Anthropic to recover.
When another key, host or model helps
Match the fix to the limit you hit.
Another key. Anthropic enforces limits at the organization level.2 A second API key inside the same organization draws on the same limits, so it adds nothing. It can still be worth having per service, so you can attribute traffic and revoke one without the others, but it is not capacity. A key from a separate organization has its own tier and limits, yet it is a separate account with its own history and terms; check your agreement before spreading one workload across accounts to get around a limit.
Another model. Each table row has its own RPM, ITPM and OTPM, and some models share a row.2 If your OTPM is exhausted on one model class, a request to a different class draws on a different bucket. That helps only if the answer from the smaller or different model is good enough for the task, which you should test before you need it.
Another host. Claude is also served from other places, and their limits are managed differently:
- On Google Cloud, the Anthropic-managed offering has rate limits managed by Anthropic; the Google-managed offering has limits managed by Google Cloud.5 The Rate limits page shows a Custom tier for every organization on the Anthropic-managed Google Cloud offering.2
- On Amazon Bedrock, Anthropic documents two endpoints.
bedrock-mantleserves the Messages API at/anthropic/v1/messages, andbedrock-runtimeserves InvokeModel and Converse.6 Model IDs differ there, and newer models need an inference profile ID rather than a base model ID, or the call returns a 400.7 Bedrock's own quotas are AWS's to state; Anthropic's page does not list them, so read them in your AWS account. - Claude Platform on AWS is different again: the Anthropic rate limits apply there, with billing through AWS rather than through Anthropic directly.2
A second host only relieves a 429 if its limits are separate from the ones you hit. Anthropic-managed Google Cloud runs on Anthropic's own rate-limit machinery, so verify that before counting on it as spare capacity. Model availability also differs by host, and the lifecycle dates on partner platforms are set by the partner.7
Neither. For the spend-cap 429, requesting a higher tier or limit from Anthropic is the direct fix; a host with its own billing and limits is the only other route.2
Doing it in a gateway
Everything above works in application code. The reason to move it into a gateway is that the decision (retry, spread, move on, stop) is the same for every call and should not be re-implemented per service.
With INFRO, you connect the provider accounts you already hold, including Anthropic, AWS Bedrock and Google Vertex AI, and your providers keep billing you directly.8 When you name a model, INFRO tries your enabled connections for that vendor and spreads requests across a provider's active keys, with standby keys and keys that just answered 429 tried last. A provider 429 before the first token moves the request to the next connection and does not count against that connection's health.9 Named routes use priority or weighted targets over your own connections with health checks, retries and failover. Alternate hosts let one connection list more API hosts for the same key, tried when the first cannot be reached. Gateway key controls limit a key to chosen providers or IP ranges and rotate it with an overlap window, which gives each service its own key.
Limits on this: moving a request to another connection only helps if that connection has separate capacity, and spreading across keys in one Anthropic organization does not add any. A 429 spend cap is not something a retry should chase. Model fallbacks to another vendor are opt-in and cross-model, so test them first.9
A checklist for the next 429
- Log the status,
error.type,error.details.error_code,retry-afterand theanthropic-ratelimit-*headers on every 429. - Branch on
enforced_spend_limit_reachedbefore the general 429 branch, and never loop on it. - Separate your own 400 spend limit from the tier's 429 spend cap in dashboards.
- Honor
retry-after; set SDK retries deliberately instead of accepting the default of two. - Check cache hit rate if ITPM is the limit; check generation length if OTPM is.
- Ramp new traffic instead of switching it on at once.
- Confirm, per fallback host or model, that its limits are separate from the ones you hit.
