Submit a toolSubmit

The LLM API returned 429. Retry only when it is a rate limit

A request failed with HTTP 429, and retrying immediately either hammers the API or hides a billing cap. Short answer: 5 steps. 1) Read the error code before you retry; 2) Wait out Retry-After when it is a real rate limit; 3) Back off only when the header is missing; 4) Don't stack a second retry loop on the official SDK; 5) Slow the burst, then open the limits page.

Last updated: · This page is the decision checklist; the tools list for “Handle an LLM API 429” is a separate URL.

The problem: A request failed with HTTP 429, and retrying immediately either hammers the API or hides a billing cap.

How do I fix this: The LLM API returned 429?

  1. Read the error code before you retry

    A 429 is not always slow down. On the OpenAI API, a temporary limit looks like rate limit reached or error code slow_down. credit_balance_exhausted, organization_usage_limit_exceeded, organization_spend_limit_exceeded and project_spend_limit_exceeded need a billing or limit change, and retrying will not clear them. On the Claude API, a 429 whose error.details.error_code is enforced_spend_limit_reached is the monthly spend cap. That response has no retry-after header. Docs: https://developers.openai.com/api/docs/guides/error-codes and https://platform.claude.com/docs/en/api/rate-limits

  2. Wait out Retry-After when it is a real rate limit

    OpenAI can send a Retry-After header on a temporary 429 (and on some 503 overloaded responses). Claude sends retry-after as the number of seconds to wait, and an earlier retry fails. Wait at least that long, then add a small random delay so many clients do not retry on the same second.

  3. Back off only when the header is missing

    If Retry-After is absent or invalid on a temporary limit, use exponential backoff with jitter, and cap both the number of attempts and the total time you spend retrying. Do not do this for a spend cap, a credit balance, or an organization usage limit. Those keep failing until you add credits, raise the limit, or the monthly cap resets.

  4. Don't stack a second retry loop on the official SDK

    The OpenAI SDKs already retry eligible 429 and 503 responses and honor Retry-After. The Anthropic SDKs retry a 429 twice by default (maxRetries / max_retries) and honor retry-after. An extra loop in your app multiplies calls. Turn the SDK retries down, or count them inside your own limit.

  5. Slow the burst, then open the limits page

    Cut parallel calls and ramp traffic up gradually. Both OpenAI and Anthropic call out sharp spikes. Then check the rate-limits page for the model you are calling. Raise a tier or a spend limit only when the error code says the cap was reached, not when the header says to wait a few seconds.

Which tools are best to handle an LLM API 429?

OpenAI rate limits

What a temporary 429 means, when Retry-After is set, and what the official SDKs retry.

OpenAI error codes

Separates rate-limit 429s from credit, usage and spend-limit 429s.

Claude API rate limits

Requests, input tokens and output tokens per minute, plus the monthly spend-cap 429.

Claude API errors

How to tell rate_limit_error from a spend cap, and the SDK default of two retries.

All tools for “Handle an LLM API 429” →

Related fixes

See also AI tools launched today on the daily board.