Anthropic API 429 rate_limit_error: rate limit, spend cap, or Claude Code workspace limit

The Claude API (Messages API at api.anthropic.com, and the official SDKs built on it) answers with HTTP 429 and error type rate_limit_error in three different situations. Anthropic's errors page, as fetched on 9 November 2026, defines it 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." One of those clears in seconds; another does not clear until next month. This page is about telling them apart before you retry.

The 30-second answer

The exact error

Every Claude API error uses the same JSON envelope: a top-level error object with type and message, plus a request_id. The only complete 429 body Anthropic's docs print is the spend-cap one:

{
  "type": "error",
  "error": {
    "type": "rate_limit_error",
    "message": "You have reached your API usage limits: your organization has crossed its monthly API usage threshold, set based on your organization's API tier. You will regain access on 2026-09-01 at 00:00 UTC.",
    "details": { "error_code": "enforced_spend_limit_reached" }
  },
  "request_id": "req_018EeWyXxfu5pfWkrYcMdjWG"
}

Source: copied from "Reaching your spend cap" on Anthropic's Rate limits page, fetched 9 November 2026 (the date in the message is the docs' sample). The docs do not print sample message text for an ordinary rate-limit 429; they say only that you get a 429 "describing which rate limit was exceeded". We did not trigger a live 429, so no rate-limit wording is quoted here.

Verified against the docs and the SDK — 9 November 2026

Confirmed on official pages today (Errors and Rate limits):

Situationretry-afterOther markerClears when
Rate limit (RPM, ITPM or OTPM)"When the response has a retry-after header, wait that many seconds"Message describes which limit was exceededCapacity refills continuously (token bucket)
Tier monthly spend capNever presenterror.details.error_code = enforced_spend_limit_reached (Messages API)00:00 UTC on the first day of the next month, or on moving to a higher tier
Claude Code workspace limitRequests "can instead receive a 429 that carries a retry-after header"Only for requests in the Claude Code workspaceNot stated on the pages fetched

A spend limit you set yourself on the Billing page is not a 429: the docs say it returns HTTP 400 invalid_request_error with a message starting You have reached your specified API usage limits.

Run today: how the Python SDK reacts. Environment: anthropic==2.7.0, Python 3.11.9, macOS arm64, a bogus API key, and a local mock HTTP server on 127.0.0.1 returning status 429. No request reached Anthropic. In (b) and (c1) the body is the documented spend-cap JSON above, served by the mock and not observed live; in (a) and (c2) the body has the documented error shape with a placeholder message.

anthropic==2.7.0, python 3.11.9, Darwin arm64, mock 127.0.0.1:59933
client default max_retries = 2

(a) 429 rate_limit_error + retry-after: 1, default max_retries
  -> anthropic.RateLimitError (bases: ['APIStatusError', 'APIError', 'AnthropicError'])
  -> server received 3 request(s), x-stainless-retry-count seen: ['0', '1', '2']
  -> gaps between requests (s): [1.0, 1.01]; client gave up after 2.0s
  -> e.status_code=429  e.request_id='req_MOCK'  e.type='rate_limit_error'
  -> e.response.headers.get('retry-after')='1'
  -> e.body['error']['type']='rate_limit_error'  e.body['error'].get('details')=None
  -> str(e)[:110]='Error code: 429 - {\'type\': \'error\', \'error\': {\'type\': \'rate_limit_error\', \'message\': "MOCK PLACEHOLDER - not A'

(b) 429 spend-cap body, NO retry-after, default max_retries
  -> anthropic.EnforcedSpendLimitReachedError (bases: ['RateLimitError', 'APIStatusError', 'APIError'])
  -> server received 3 request(s), x-stainless-retry-count seen: ['0', '1', '2']
  -> gaps between requests (s): [0.41, 0.98]; client gave up after 1.4s
  -> e.status_code=429  e.request_id='req_018EeWyXxfu5pfWkrYcMdjWG'  e.type='rate_limit_error'
  -> e.response.headers.get('retry-after')=None
  -> e.body['error']['type']='rate_limit_error'  e.body['error'].get('details')={'error_code': 'enforced_spend_limit_reached'}
  -> str(e)[:110]='Error code: 429 - {\'type\': \'error\', \'error\': {\'type\': \'rate_limit_error\', \'message\': "You have reached your AP'

(c1) 429 spend-cap body, NO retry-after, max_retries=0
  -> anthropic.EnforcedSpendLimitReachedError (bases: ['RateLimitError', 'APIStatusError', 'APIError'])
  -> server received 1 request(s), x-stainless-retry-count seen: ['0']
  -> gaps between requests (s): []; client gave up after 0.0s
  -> e.status_code=429  e.request_id='req_018EeWyXxfu5pfWkrYcMdjWG'  e.type='rate_limit_error'
  -> e.response.headers.get('retry-after')=None
  -> e.body['error']['type']='rate_limit_error'  e.body['error'].get('details')={'error_code': 'enforced_spend_limit_reached'}
  -> str(e)[:110]='Error code: 429 - {\'type\': \'error\', \'error\': {\'type\': \'rate_limit_error\', \'message\': "You have reached your AP'

(c2) 429 rate_limit_error + retry-after: 1, max_retries=0
  -> anthropic.RateLimitError (bases: ['APIStatusError', 'APIError', 'AnthropicError'])
  -> server received 1 request(s), x-stainless-retry-count seen: ['0']
  -> gaps between requests (s): []; client gave up after 0.0s
  -> e.status_code=429  e.request_id='req_MOCK'  e.type='rate_limit_error'
  -> e.response.headers.get('retry-after')='1'
  -> e.body['error']['type']='rate_limit_error'  e.body['error'].get('details')=None
  -> str(e)[:110]='Error code: 429 - {\'type\': \'error\', \'error\': {\'type\': \'rate_limit_error\', \'message\': "MOCK PLACEHOLDER - not A'

What that shows:

Not verified: the wording of a live rate-limit message, the Claude Code workspace 429 body, acceleration-limit 429s and Console screens. None of those can be reproduced without a paid, signed-in account.

Cause 1: a per-minute rate limit (the 429 has retry-after)

Per the rate-limits page, Messages API limits are measured in requests per minute (RPM), input tokens per minute (ITPM) and output tokens per minute (OTPM) for each model class, and exceeding any one returns a 429. The same page documents these points:

If you use fast mode (speed: "fast"), it has separate limits; exceeding them returns a 429 with retry-after.

Cause 2: the tier's monthly spend cap (no retry-after)

The docs list monthly spend caps of $500 USD (Start), $1,000 USD (Build) and $200,000 USD (Scale); Custom has none. Once the cap is reached, "API usage pauses until 00:00 UTC on the first day of the next month, unless you request a higher limit sooner." Backoff does nothing here. The fix is Request tier increase in the Console or contacting Anthropic support, both named on the rate-limits page.

To stop wasting retries, branch on the documented field. This snippet was run against the same mock and took the first branch for the spend-cap body and the second for the retry-after: 1 response:

import anthropic

client = anthropic.Anthropic(max_retries=0)   # you decide what is worth retrying
try:
    client.messages.create(model="claude-sonnet-5", max_tokens=16,
                           messages=[{"role": "user", "content": "hi"}])
except anthropic.RateLimitError as e:
    details = (e.body or {}).get("error", {}).get("details") or {}
    retry_after = e.response.headers.get("retry-after")
    if details.get("error_code") == "enforced_spend_limit_reached":
        print("spend cap: stop, do not retry")
    elif retry_after is not None:
        print(f"rate limit: wait {retry_after}s, then retry")
    else:
        print("429 with no retry-after and no spend-cap code: back off, read the message")

Cause 3: a spend limit on the Claude Code workspace

The errors page names this as the third source of 429s, and the rate-limits page says limits on the Claude Code workspace "are checked separately" and can return a 429 that carries retry-after. So if the failing requests come from Claude Code and your organization-wide rate limits look healthy, check that workspace's limits in the Console. The pages fetched today do not show this response's body, so we cannot say how its message reads.

FAQ

Is a Claude API 429 always a rate limit? No. Anthropic's errors page, as fetched on 9 November 2026, says a 429 rate_limit_error means 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. The error type is the same in all three cases; the retry-after header and error.details.error_code tell them apart.

Why does my Anthropic 429 have no retry-after header? Per Anthropic's rate-limits page, not every 429 carries retry-after, and the spend-cap 429 never does. If the body has error.details.error_code set to enforced_spend_limit_reached, your organization has reached its tier's monthly spend cap and retries keep failing until access resumes at 00:00 UTC on the first day of the next month, or until you move to a higher tier.

Does the Anthropic Python SDK retry a 429 automatically? Yes. Anthropic's docs say the SDK retries rate limits twice by default and honors retry-after when present. In our local mock test with anthropic 2.7.0, one messages.create() call produced three HTTP requests in both cases: 2.0 seconds with retry-after: 1, and 1.4 seconds for a spend-cap body with no retry-after. With max_retries=0 it made one request and raised immediately.

Does a high max_tokens value cause output-token 429s? Not according to Anthropic's rate-limits page: OTPM limits count only the output tokens actually generated, and the max_tokens parameter does not factor into the OTPM calculation. The same page says cache_read_input_tokens do not count toward ITPM, so prompt caching raises effective input throughput.


Related

Verified on 9 November 2026: causes, headers, tiers and the example JSON quoted from platform.claude.com/docs/en/api/errors and /api/rate-limits as fetched that day; SDK retry and exception behaviour reproduced with anthropic 2.7.0 against a local mock server (output shown above). No live 429 was triggered and Console steps were not re-verified.