Blog

API rate limit exceeded: what the 429 means and how to fix it on OpenAI, Claude, Gemini and DeepSeek

Ramashankar S · · Updated · 16 min read

An API rate limit exceeded error means you sent more requests, or more tokens, in a time window than your account allows, so the server answered HTTP 429 Too Many Requests and did not run the request. It clears on its own: wait the number of seconds in the Retry-After header, or back off exponentially with random jitter, then send the same request again.

The catch is that LLM providers also return 429 for problems a retry can't fix. OpenAI sends one when your prepaid balance is empty, Anthropic when your tier's monthly spend cap is reached, and Gemini when a daily quota is used up. Retrying those only adds delay.

Below: how to tell them apart on OpenAI, Anthropic (Claude), Google Gemini and DeepSeek, the tier limits as of 5 November 2026, and retry code tested with openai 3.45.0, anthropic 2.4.0 and google-genai 2.34.0.

What does rate limit exceeded mean?

A rate limit counts what you send per window and refuses the request that goes over. LLM APIs count several things, and whichever runs out first triggers the error:

  • Requests per minute (RPM) and, on some models, requests per day (RPD).
  • Tokens per minute (TPM). Anthropic counts input (ITPM) and output (OTPM) separately.
  • Requests in flight at the same moment, which is DeepSeek's only published limit.
  • Dollars spent per 10 minutes, a separate Gemini limit.

Limits belong to the account, not the key. OpenAI applies them per organization and project, Gemini per project ("not per API key"), and DeepSeek per account "regardless of which API Key is used". A second key in the same account adds no capacity.

Three details explain most 429s that arrive below the published limit:

  • Limits are enforced in short slices. Anthropic's rate limits page says 60 RPM may be enforced as 1 request per second, and its token bucket refills continuously rather than resetting each minute.
  • Failed requests count. OpenAI's rate limits guide says unsuccessful requests use up your per-minute limit, so a tight retry loop keeps you over it.
  • Growth rate counts. OpenAI's slow_down and Anthropic's acceleration limits can fire when traffic jumps, even below your RPM and TPM.

Which API rate limit exceeded error did you get?

The status code alone doesn't tell you. Read the code in the body.

Which 429 is it: ten common rate limit and quota errors from OpenAI, Anthropic, Gemini and DeepSeek, what each means and whether to retry

OpenAI

OpenAI's error codes guide lists these under 429 and 503:

Status and error.codeCauseRetry?
429 rate_limit_exceededRPM or TPM for that model at your tierYes, after Retry-After
429 slow_down (type rate_limit_error)Traffic grew too fastYes, at a lower rate
429 credit_balance_exhaustedPrepaid balance is emptyNo
429 organization_spend_limit_exceeded, project_spend_limit_exceededA hard spend limit you setNo
429 organization_usage_limit_exceededOpenAI's monthly usage limit for your tierNo
503 server_is_overloadedThe model is overloadedYes

Billing errors can still carry error.type insufficient_quota, the type that usually comes with OpenAI's "You exceeded your current quota" message. Since 2 September 2026, fast ramps return 429 slow_down, not 503. A TPM message shows your limit, tokens used and tokens requested, per Microsoft's Dev Proxy guide.

One 429 isn't about you: Flex processing returns 429 Resource Unavailable when capacity is short, and OpenAI's Flex guide says you aren't charged for it.

Anthropic (Claude)

A rate-limit 429 has type rate_limit_error, a message naming the limit, and often a retry-after header (not every 429 has one). A public report from March 2026 quotes one:

This request would exceed the rate limit for your organization (...) of 2,000,000 input tokens per minute.

The monthly spend cap looks almost the same. From Anthropic's docs:

{
  "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"
}

It has no retry-after header, and retries, the SDK's included, fail until access resumes. A spend limit you set yourself returns a 400 invalid_request_error instead. A 529 overloaded_error means the API is busy for everyone; see what to do during an LLM API outage.

Gemini

Gemini reports per-minute and per-day quotas alike as 429 RESOURCE_EXHAUSTED, usually with the text "You exceeded your current quota". The detail that matters is in the body. Trimmed from public reports:

{"error": {"code": 429, "status": "RESOURCE_EXHAUSTED",
  "message": "You exceeded your current quota, please check your plan and billing details. ...",
  "details": [
    {"@type": "type.googleapis.com/google.rpc.QuotaFailure",
     "violations": [{"quotaId": "GenerateRequestsPerDayPerProjectPerModel-FreeTier"}]},
    {"@type": "type.googleapis.com/google.rpc.RetryInfo", "retryDelay": "34.074824224s"}]}}

A quotaId with PerMinute clears within a minute. One with PerDay resets at midnight Pacific time, whatever retryDelay says. Google documents no rate-limit headers, so the wait is only in the body. An empty Prepay balance returns 402, which Google's troubleshooting guide says not to retry.

DeepSeek

DeepSeek publishes no RPM or TPM limits. Its rate limit page caps requests in flight per account: 2,500 on deepseek-flash and 500 on deepseek-v4-pro. A request counts from the moment it's sent until the response finishes, and anything over the cap gets a 429. An empty balance is a 402 and an overloaded server a 503. A queued request gets keep-alive lines, and DeepSeek drops it if inference hasn't started within 10 minutes.

Rate limit or quota: the 429s a retry can't fix

ProviderErrorCauseWhat restores access
OpenAI429 credit_balance_exhaustedPrepaid balance is emptyPay in billing settings
OpenAI429 *_spend_limit_exceededYour own hard spend limitRaise it, or wait for the monthly reset
OpenAI429 organization_usage_limit_exceededTier's monthly usage limit ($500 on Build)A higher approved limit, or the next tier
Anthropic429 enforced_spend_limit_reachedTier's spend cap ($500 on Start)Tier increase, or 00:00 UTC on the 1st
Anthropic400 "You have reached your specified API usage limits"Your own spend limitRaise it
Gemini429 RESOURCE_EXHAUSTED, PerDay quotaDaily quotaMidnight Pacific, or a paid tier
Gemini402 payment_requiredPrepay balance at $0Buy more, or turn on auto-reload
DeepSeek402 Insufficient BalanceBalance is emptyPay

Gemini also pauses every project on a billing account at its tier's monthly spend cap until the 1st. Your retry code must refuse all of these: the OpenAI and Anthropic SDKs retry a 429 without reading its code.

OpenAI API rate limits by usage tier

OpenAI API rate limits depend on your usage tier and the model. On 6 October 2026 OpenAI cut its paid tiers from five to three, so any guide showing Tier 1 to Tier 5 is out of date. From the rate limits guide and the model pages, 5 November 2026:

TierHow you qualifyMonthly usage limitgpt-6-astra, gpt-6.1-sol, gpt-6.1-terra (RPM / TPM)gpt-6-luna (RPM / TPM)
FreeIn an allowed country$100Not supportedNot supported
Build$5 paid in total$5005,000 / 1,000,0005,000 / 2,000,000
Launch$100 paid in total$5,00010,000 / 4,000,00010,000 / 10,000,000
Grow$500 paid in total$200,00015,000 / 40,000,00030,000 / 180,000,000
  • You move up automatically when total payments reach the threshold. Grow used to need $1,000. Check your tier and per-model limits under Settings > Organization > Limits, where Upgrade tier sits in the Usage Tiers section.
  • The Free tier can't call the GPT-6 models or gpt-5.6-luna. It can use embeddings: text-embedding-3-small allows 100 RPM, 2,000 RPD and 40,000 TPM.
  • Long-context requests have a separate limit, some model families share one limit, and an organization owner can set lower limits per project.
  • Above 1 million TPM, OpenAI's rule of thumb is to grow traffic by no more than 50% every 15 minutes. Going from 1 million to 4 million TPM takes four steps, about an hour.

The OpenAI API guide covers keys, billing and the first request.

How OpenAI, Anthropic and Gemini raise rate limits by tier, with monthly caps and per-model limits

Claude and Gemini tiers

Anthropic assigns tiers from usage history; new organizations may start in an Evaluation tier below Start. Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 each get their own limits:

Anthropic tierMonthly spend capRPMInput tokens/minOutput tokens/min
Start$5004,0002,000,000400,000
Build$1,00010,0005,000,0001,000,000
Scale$200,00013,00010,000,0002,000,000

Ask for more with Request tier increase on the Console's Rate limits page. The Claude API key guide covers the Console side.

Gemini publishes the tiers but shows per-model limits only in AI Studio:

Gemini tierHow you qualifyMonthly spend capSpend per 10 minutes
FreeActive projectNoneNone
Tier 1Billing account linked$250$10
Tier 2$100 paid, 3 days after first payment$2,000$200
Tier 3$1,000 paid, 30 days after first payment$20,000 to $100,000+$200

The spend-rate limit bites early. A Gemini 3.8 Flash request with 10,000 input and 1,000 output tokens costs $0.01125 at $0.75 / $3.75 per million, so a Tier 1 project can send about 888 of them per 10 minutes, roughly 89 a minute. From 1 January 2027 the price doubles and that halves to about 44. The Gemini API pricing guide has the full price list.

Fix 1: retry with backoff, jitter and Retry-After

The official SDKs each handle a 429 differently. Against a local server that always returns 429:

What the OpenAI, Anthropic and Google GenAI Python SDKs do with a 429: how many requests each sends and whether it honors Retry-After
SDKDefault retriesDelay without a headerRetry-After
openai 3.45.020.5 s, then 1 s, doubling to 8 s, minus up to 25%Honored up to 120 s; longer means no retry
anthropic 2.4.02SameHonored, no upper limit
google-genai 2.34.00With HttpRetryOptions(): 4 retries, about 1, 2, 4, 8 s plus jitterIgnored

Google's troubleshooting page says the Python SDK retries up to four times by default. In 2.34.0 it sent one request and stopped until retry options were passed.

So without a header the OpenAI and Anthropic SDKs give up after about two seconds, and they treat a spend cap like a busy minute. The rules from OpenAI's guide hold for every provider: treat Retry-After as a minimum and add a small random delay, cap both attempts and total time, never retry billing errors, and turn off SDK retries when you wrap your own (otherwise 3 SDK attempts times 6 of yours is 18 requests).

import random
import time
from email.utils import parsedate_to_datetime

import openai


def header_wait(headers):
    """Seconds the server asked for in retry-after-ms or Retry-After, else None."""
    if headers is None:
        return None
    ms = headers.get("retry-after-ms")
    if ms:
        try:
            return float(ms) / 1000
        except ValueError:
            pass
    value = headers.get("retry-after")
    if not value:
        return None
    try:
        return float(value)                      # "20"
    except ValueError:
        try:                                     # "Wed, 05 Nov 2026 18:00:00 GMT"
            return max(0.0, parsedate_to_datetime(value).timestamp() - time.time())
        except (TypeError, ValueError):
            return None


def with_backoff(call, classify, attempts=6, base=1.0, cap=60.0, deadline=300.0):
    """Run call(); on a retryable error wait and try again.
    classify(err) returns (retry, wait_hint), where wait_hint is the server's delay or None."""
    start = time.monotonic()
    for attempt in range(1, attempts + 1):
        try:
            return call()
        except Exception as err:
            retry, hint = classify(err)
            if not retry or attempt == attempts:
                raise
            if hint is None:
                wait = random.uniform(0, min(cap, base * 2 ** attempt))  # full jitter
            else:
                wait = hint + random.uniform(0, 1)  # server minimum, plus a little spread
            if time.monotonic() - start + wait > deadline:
                raise  # out of time: queue the job instead of hammering
            time.sleep(wait)


client = openai.OpenAI(max_retries=0)  # this loop owns the retries

STOP_CODES = {
    "insufficient_quota", "credit_balance_exhausted", "organization_spend_limit_exceeded",
    "project_spend_limit_exceeded", "organization_usage_limit_exceeded",
}


def classify_openai(err):
    if isinstance(err, openai.RateLimitError):           # 429
        if err.code in STOP_CODES or err.type == "insufficient_quota":
            return False, None                            # billing, not speed
        return True, header_wait(err.response.headers)
    if isinstance(err, openai.InternalServerError):       # 500, 503 server_is_overloaded
        return True, header_wait(err.response.headers)
    if isinstance(err, openai.APIConnectionError):        # includes timeouts
        return True, None
    return False, None                                    # 400, 401, 402, 403, 404


response = with_backoff(
    lambda: client.responses.create(model="gpt-6-luna", input="Say hello."),
    classify_openai,
)

The same classify_openai works for DeepSeek and other OpenAI-compatible APIs: point the client at their base URL and their 402 falls through as "don't retry". For Claude and Gemini, swap the classifier:

import anthropic
from google.genai import errors


def classify_anthropic(err):
    if isinstance(err, anthropic.RateLimitError):        # 429
        error = err.body.get("error", {}) if isinstance(err.body, dict) else {}
        if (error.get("details") or {}).get("error_code") == "enforced_spend_limit_reached":
            return False, None                            # tier spend cap: wait for the 1st
        return True, header_wait(err.response.headers)
    if isinstance(err, anthropic.InternalServerError):    # 500, 529 overloaded_error
        return True, header_wait(err.response.headers)
    if isinstance(err, anthropic.APIConnectionError):
        return True, None
    return False, None


def classify_gemini(err):
    if not isinstance(err, errors.APIError):
        return False, None
    if err.code in (500, 503, 504):
        return True, None
    if err.code != 429:
        return False, None                                # 400, 402 Prepay empty, 403
    body = err.details if isinstance(err.details, dict) else {}
    hint = None
    for d in body.get("error", body).get("details", []):
        if d.get("@type", "").endswith("QuotaFailure"):
            for v in d.get("violations", []):
                if "PerDay" in v.get("quotaId", ""):
                    return False, None                    # daily quota: resets at midnight PT
        if d.get("@type", "").endswith("RetryInfo"):
            hint = float(d.get("retryDelay", "0s").rstrip("s"))  # "34.07s" -> 34.07
    return True, hint

Create the Claude client with anthropic.Anthropic(max_retries=0). Against a local server returning each documented body, this code waited out Retry-After and succeeded, stopped at once on insufficient_quota, credit_balance_exhausted, enforced_spend_limit_reached and a PerDay quota, and honored a 1.5 s retryDelay on a per-minute quota. On streaming requests, retry only errors that arrive before the stream starts; never replay one after you've used part of its output.

Retries with jitter, explainedSoftware Developer Diaries · 9:20 · YouTube
Why exponential backoff without jitter causes retry storms, and how full and equal jitter fix it, published 20 August 2026.

Fix 2: send fewer requests and fewer counted tokens

Backoff gets one request through. If 429s are routine, cut what counts against the limit:

  • Move work that doesn't need an answer right away to a batch API. OpenAI's Batch API doesn't touch your live limits and costs 50% less, with its own queue limit (20,000,000 tokens for gpt-6-luna on Build). Anthropic's Message Batches and Gemini's Batch API also have their own limits.
  • Cache stable prompt prefixes on Claude. On most Claude models only uncached input counts toward ITPM, so at an 80% cache hit rate a 2,000,000 ITPM limit carries 10,000,000 input tokens a minute.
  • Set the output cap close to what you need on OpenAI. Its limiter counts the larger of max_tokens and the estimated tokens in your request. Claude counts only output actually generated.
  • If you hit RPM with TPM to spare, put several small tasks in one request.
  • Cap concurrency where the limit is concurrency, as on DeepSeek:
import os
import threading
import openai

ds = openai.OpenAI(base_url="https://api.deepseek.com", api_key=os.environ["DEEPSEEK_API_KEY"])
in_flight = threading.BoundedSemaphore(400)  # under deepseek-v4-pro's 500 per account


def ask_deepseek(messages):
    with in_flight:
        return ds.chat.completions.create(model="deepseek-v4-pro", messages=messages)

Fix 3: spread load across models

Limits are per model, so a second model is spare capacity. Claude Sonnet 5.5 and Opus 5.5 each have their own 4,000 RPM on Start. OpenAI's limits vary by model too, though models listed under a "shared limit" on your limits page draw on one pool. When the main model stays limited after a few retries, move the request down a list:

def ask(prompt, models=("gpt-6.1-sol", "gpt-6-luna")):
    for model in models:
        try:
            return with_backoff(
                lambda: client.responses.create(model=model, input=prompt),
                classify_openai, attempts=3, deadline=20,
            )
        except openai.RateLimitError as err:
            if err.code in STOP_CODES:
                raise          # billing: another model won't help
    raise RuntimeError("every model is rate limited")

Two related moves: on Flex, retry a 429 Resource Unavailable with service_tier set to auto to fall back to standard processing, and give each app its own OpenAI project or Claude workspace with lower limits, so one batch job can't starve the rest. The OpenAI spending limits guide covers project limits.

Monitor your limits before they bite

Every OpenAI and Claude response reports how much room is left:

ProviderHeadersReset format
OpenAIx-ratelimit-limit-*, x-ratelimit-remaining-*, x-ratelimit-reset-* for requests and tokens, plus -project-tokensDuration, such as 1s or 6m0s
Anthropicanthropic-ratelimit-requests-*, -input-tokens-*, -output-tokens-* (-limit, -remaining, -reset)RFC 3339 time
GeminiNone documentedRetryInfo in the 429 body
DeepSeekNone documentedCount requests in flight yourself

Read them without losing the parsed response:

raw = client.responses.with_raw_response.create(model="gpt-6-luna", input="ping")
h = raw.headers
print(h.get("x-ratelimit-remaining-requests"), h.get("x-ratelimit-remaining-tokens"),
      h.get("x-ratelimit-reset-tokens"))
response = raw.parse()

messages.with_raw_response.create(...) does the same in the anthropic SDK. Anthropic rounds remaining tokens to the nearest thousand.

Then:

  • Log 429s by error.code or quotaId, not by status, so quota problems don't hide among rate limits.
  • Alert when remaining requests or tokens fall below about 20%.
  • Check the dashboards: OpenAI's Limits page, the Claude Console's Usage page (peak tokens per minute against your limit) and AI Studio's rate-limit page.
  • Test error paths before production: Microsoft's Dev Proxy openai-throttling preset returns OpenAI's real 429 and 503 bodies with Retry-After, and a 30-line local server works for any provider.

What developers report

  • "it’s always about squeezing within TPM limits" (OpenAI Developer Community reply to OpenAI's tier announcement, 6 Oct 2026, link)
  • Across public SWE-bench Pro runs, 36 of 730 Claude Sonnet 4.5 trajectories (4.9%) ended on Anthropic 429s and were scored as task failures, undercounting the model by 1.3 points (GitHub issue on scaleapi/SWE-bench_Pro-os, 10 Mar 2026, link)
  • An eval harness retried a Gemini free-tier PerDay quota 429 for over ten minutes until stopped by hand; the report notes that gemini-cli treats PerDay quotas as final (GitHub issue on UKGovernmentBEIS/inspect_ai, 23 Sep 2026, link)
  • A paid Tier 1 user got 429 RESOURCE_EXHAUSTED from Gemini 2.5 Flash while, by the reporter's account, RPM, TPM and RPD stayed below their limits (GitHub issue on googleapis/python-genai, 16 Feb 2026, link)
  • "Probably the HN hug of death happening." A commenter trying a Gemini-backed demo saw nearly every request fail with Gemini's quota 429 (Hacker News, 22 Apr 2026, link)

Rate limits on Aight

Aight is one OpenAI-compatible API for 138 models, and going by its documented error codes, the classify_openai function above handles it as is. Its API reference keeps rate limits and money apart: a 429 means too many requests for that key in one minute (wait for Retry-After), a 402 out_of_balance is "never a rate limit", a 403 key_cap_reached means the key hit its own monthly cap, and a 503 balance_unverifiable wasn't run or charged and can be retried. The error code sits in the body's param field.

What it adds for rate-limit work: the fallback list in Fix 3 can mix makers on one key and one balance, for example gpt-6-luna ($0.10 / $0.50 per million tokens), DeepSeek-V4.1-Flash ($0.30 / $1.20) and claude-sonnet-5-5 ($2.00 / $10.00). A per-key monthly cap also stops a runaway retry loop from spending more than you planned.

Where direct is better: Aight doesn't publish its per-minute number, so load-test your peak before moving production traffic. It documents no batch endpoint, so work that can wait costs half as much through OpenAI's Batch API. And Gemini's free tier costs nothing.

FAQ

How long does a rate limit exceeded error last?

For per-minute limits, seconds to a few minutes. The Retry-After header, OpenAI's x-ratelimit-reset-* headers or Gemini's RetryInfo tell you how long. Daily quotas last until their reset (midnight Pacific on Gemini), and monthly spend caps until the 1st.

Do failed requests count against the rate limit?

On OpenAI, yes: its guide says unsuccessful requests count toward your per-minute limit. A tight retry loop keeps you limited, so the wait between attempts has to grow.

Can more API keys raise a rate limit?

No. OpenAI applies limits per organization and project, Gemini per project and DeepSeek per account, whatever key you use. Higher limits come from a higher tier or a request to the provider.

Why does a 429 arrive below the limit?

Short-window enforcement (60 RPM can mean 1 request per second), a fast ramp (slow_down or an acceleration limit), other people's traffic in the same organization, or a quota error that isn't a rate limit at all. Read the code in the body before changing anything.

Is "You exceeded your current quota" a rate limit?

On OpenAI it's billing: the insufficient_quota type means an empty balance or a spend or usage limit, and retrying won't help. On Gemini the same words cover per-minute and per-day quotas, so check the quotaId: per-minute quotas clear quickly, per-day ones at midnight Pacific.


Sources

Checked on 5 November 2026. Updated 17 November 2026: Aight's current model list.