OpenAI 429 Error: insufficient_quota vs rate_limit_exceeded
When the OpenAI API returns a 429, look at error.code in the response body first. If it is insufficient_quota (message: "You exceeded your current quota"), your account quota, balance, or spending cap is used up. No amount of waiting or retrying will fix it; you have to deal with billing in the dashboard. If it is rate_limit_exceeded, you exceeded the request or token limit for a time window, and slowing down and retrying with backoff will recover. 429 is only a status code. The code decides what you do.
This article covers how to get the evidence, a table mapping each code to an action, the problem with SDK auto-retries, and how to recognize 429s that come from a platform incident.
What do the two kinds of 429 look like?
OpenAI error responses are JSON, roughly shaped like this (treat the actual response as authoritative).
Quota error:
{
"error": {
"message": "You exceeded your current quota, please check your plan and billing details...",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota"
}
}
Rate limit error:
{
"error": {
"message": "Rate limit reached for ... on tokens per min (TPM): Limit ..., Used ..., Requested .... Please try again in 1.2s...",
"type": "tokens",
"param": null,
"code": "rate_limit_exceeded"
}
}
How to tell them apart:
- A rate limit message usually says which limit you hit (requests per min, tokens per min, and so on) and gives a wait time ("Please try again in ...").
- A quota message points to your plan and billing and gives no wait time.
- Many logs record only the status code and exception class, so both cases show up as
RateLimitError. If that is all your log says, print the full response body first.
How do I see the code and the limits with one curl?
Reproduce with a minimal request and save both headers and body. Replace $MODEL with the model you actually use, and keep the prompt short so the investigation does not burn more quota.
curl -sS -D headers.txt -o body.json \
https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"'"$MODEL"'","messages":[{"role":"user","content":"ping"}],"max_tokens":1}'
head -n 1 headers.txt # status code
grep -i '^x-ratelimit\|^retry-after\|^x-request-id' headers.txt
python3 -m json.tool body.json # check error.code and message
If you have multiple organizations or projects, include the matching OpenAI-Organization or OpenAI-Project header. Otherwise you may be testing a different project from the one that is failing.
The x-ratelimit-* response headers are the main evidence for rate problems:
| Header | Meaning |
|---|---|
x-ratelimit-limit-requests | Requests allowed in the current window |
x-ratelimit-remaining-requests | Requests left in the window |
x-ratelimit-reset-requests | Time until the request limit resets, such as 1s or 6m0s |
x-ratelimit-limit-tokens | Tokens allowed in the current window |
x-ratelimit-remaining-tokens | Tokens left in the window |
x-ratelimit-reset-tokens | Time until the token limit resets |
How to read them: if remaining is close to 0 and reset is measured in seconds, it is a rate problem. If remaining is still plentiful but you get a 429 with code insufficient_quota, it is a billing problem and has nothing to do with request speed. Log x-request-id too; you will need it when you contact OpenAI support.
Error code, cause, and action
The rightmost column decides how your code should behave: retry or not.
| error.code / symptom | Common cause | What to do | Does retrying help? |
|---|---|---|---|
insufficient_quota | Prepaid balance used up, promotional credit expired, or no valid payment method | Check balance and payment status on the Billing page in the dashboard, then add funds or change the payment method before calling again | No. Stop immediately |
insufficient_quota, but the balance looks fine | The organization or project has a monthly spending limit (budget) that has been reached, or the key belongs to a different organization/project with a zero balance | Check limits at both the organization and project level, and confirm which organization and project the key belongs to | No |
rate_limit_exceeded, message mentions requests | RPM (requests per minute) or RPD (requests per day) exceeded, often from a concurrency spike | Control concurrency and back off according to x-ratelimit-reset-requests or the wait time in the message | Yes, after backoff |
rate_limit_exceeded, message mentions tokens | TPM exceeded, often from long contexts, a large max_tokens, or batch jobs | Reduce input per request, lower max_tokens, split batch jobs, or switch to the Batch API | Yes, after backoff |
| 429 with a message about Batch / enqueued tokens | Total tokens queued in batches exceeds the limit | Wait for existing batches to finish, then submit new ones | Submitting later helps; retrying immediately does not |
| 429s clustered in one time window, affecting multiple projects | Possibly a platform-side problem | Check the status page first; once confirmed, degrade gracefully or wait for recovery | Depends on the incident |
RPM, TPM, and usage tier differ by organization. Go by the numbers on the Limits page in your dashboard, not by values someone posted online. For the official details, see the Rate limits guide and the Error codes guide.
Why do SDK auto-retries make things worse?
OpenAI's official Python and Node SDKs automatically retry 429s, some 5xx errors, and connection errors by default (2 retries, with backoff). You can change this with max_retries / maxRetries. The default helps with occasional rate limiting, but it causes two problems:
- It also retries
insufficient_quota. The SDK does not look at the code behind a 429. When your quota is gone, every request sends 2 extra calls that are guaranteed to fail: more latency, more log noise, same result. - It stacks with your own retries. Say your application code retries 3 more times on the outside, and each attempt makes up to 3 calls inside the SDK: one user request can become 9 upstream calls. If a job queue redelivers on failure, the count multiplies again. Under a rate limit, this drains remaining even faster, so the more you retry, the more you get throttled.
We recommend turning off the SDK's automatic retries and branching on the code in your own logic:
from openai import OpenAI, RateLimitError
client = OpenAI(max_retries=0) # leave all retrying to our own logic
class QuotaExhausted(Exception):
"""Quota-type 429: do not retry, raise an alert"""
def call(**kwargs):
try:
return client.chat.completions.create(**kwargs)
except RateLimitError as e:
code = getattr(e, "code", None)
if code is None and isinstance(e.body, dict):
code = e.body.get("code") or (e.body.get("error") or {}).get("code")
if code == "insufficient_quota":
raise QuotaExhausted(str(e)) from e # alert right away so a human checks billing
raise # rate limit: let the outer layer do exponential backoff with jitter and a retry cap
The exact structure of code and body on the exception object may vary across SDK versions, so print a real 429 once before you ship. For how to write backoff and retry budgets, see How to write LLM API retries: exponential backoff, jitter, and retry budgets. For how RPM and TPM are counted and how to use Retry-After, see What to do when an API returns 429 Too Many Requests, which goes into more detail.
Checklist for quota-type 429s
When you hit insufficient_quota, check in this order:
- Confirm which organization and project the key belongs to. The API keys page in the dashboard shows the project for each key. When several people share environment variables, it is easy to end up using a key from someone else's project.
- Check the balance and payment method: is the prepaid balance zero, has promotional credit expired, did the card charge fail?
- Check spending limits. A budget can be set at both the organization and project level; what happens when it is reached is described in the dashboard.
- Check the usage page. Look at consumption by project and by day to see whether a runaway job used up the quota, such as an infinite loop of calls or a leaked key.
- After fixing it, test again with the curl above. Billing state can lag. If the test still fails right after adding funds, wait a few minutes and try again. Do not write a polling loop in your code.
If you suspect a key leak, revoke the old key and create a new one in the dashboard first, then look at usage. Changes in pricing or billing rules can also use up quota earlier than expected; for how to track them, see How to find out right away when LLM API prices change.
How do I recognize a 429 caused by a platform incident?
Sometimes your code has not changed and your request volume has not changed, yet 429s suddenly increase. Consider a platform-side problem. cdnping syncs the official OpenAI status page every 15 minutes. In the incident records we have synced since September 17, 2026, OpenAI has 4 major incidents, 19 minor incidents, and 2 with no impact level (none). Among them, "Widespread feature degradation," which began at 16:29 UTC on 2026-10-15, was marked major and lasted about 146 minutes. Errors during an incident are not always 5xx; they can also show up as unusual rate limiting or timeouts. For the full incident tally, see AI service incidents: September to October 2026.
Steps to check:
- Open cdnping's OpenAI API status page and see whether there is an ongoing official incident, and whether edge-probe latency and availability look abnormal.
- If you also use ChatGPT or Codex, check the user reports on Is ChatGPT down?, which includes a "rate limited" category.
- Compare against your own
x-ratelimit-remaining-*: if you getrate_limit_exceededwhile plenty of remaining is left and the status page shows an incident, you can fairly safely attribute it to the platform. - During an incident, lower concurrency and pause batch jobs. Do not push through by retrying harder.
cdnping's edge probes (every 5 minutes, from the Cloudflare edge to the OpenAI API entry point) only show whether the entry point is reachable and how fast it responds. They cannot see the quota or rate-limit state of any specific account. For account-level 429s, the response body and headers are all you have. For how to interpret incident severity on a status page, see How to read the OpenAI and Claude status pages.
How is this different from other error codes?
429 is just one category in the "should I retry?" decision: 401 means the key is invalid, so retrying is pointless; 500, 502, and 503 are mostly transient and can be retried a limited number of times; Claude's 529 means the service is overloaded, which is different from 429. For the full cheat sheet, see LLM API error codes from 400 to 529: a cheat sheet. For the Claude-side distinction, see What Claude's 529 overloaded_error means.
Troubleshooting order at a glance
- Read
error.codefirst: forinsufficient_quota, check billing; forrate_limit_exceeded, control your request rate. - Use curl to get the
x-ratelimit-*headers. Remaining and reset tell you whether it is a rate problem. - Turn off the SDK's default retries or manage them in one place. Do not retry quota-type 429s; raise an alert instead.
- When request volume has not changed but 429s spike, check /en/status/openai first, then your own response headers.