OpenAI API Error 429
"Too Many Requests" — what causes it, how to fix it in code, and how to tell if it is a real OpenAI outage vs a rate limit.
OpenAI — live API status
If Operational, it is your rate limit, not an outage. View incidents →
What is the OpenAI 429 error?
HTTP 429 "Too Many Requests" means your API key sent more requests than your current rate limit allows. OpenAI enforces limits on three dimensions:
- RPM (requests per minute) — total API calls per minute
- TPM (tokens per minute) — total input + output tokens per minute
- RPD (requests per day) — daily request cap, especially on lower tiers
Check your current limits and usage at platform.openai.com/account/limits.
429 vs 529: which do you have?
| Status | Cause | Fix |
|---|---|---|
429 | Your account rate limit | Slow down, use backoff, upgrade tier |
529 | OpenAI servers overloaded | Retry with backoff, wait for recovery |
500/503 | Platform outage | Check status, wait |
Fix: exponential backoff in code
The OpenAI SDK handles 429 retries automatically if you set max_retries:
# Python — built-in retry
import openai
client = openai.OpenAI(max_retries=5) # retries on 429 + 529
# Manual implementation
import time, random
def call_with_backoff(fn, max_attempts=5):
for attempt in range(max_attempts):
try:
return fn()
except openai.RateLimitError as e:
if attempt == max_attempts - 1:
raise
delay = (2 ** attempt) + random.random()
time.sleep(delay)
// TypeScript — built-in retry
import OpenAI from 'openai';
const client = new OpenAI({ maxRetries: 5 });
// Manual implementation
async function callWithBackoff(fn: () => Promise<any>, maxAttempts = 5) {
for (let attempt = 0; attempt < maxAttempts; attempt++) {
try {
return await fn();
} catch (e: any) {
if (e?.status !== 429 || attempt === maxAttempts - 1) throw e;
const delay = Math.pow(2, attempt) * 1000 + Math.random() * 1000;
await new Promise(r => setTimeout(r, delay));
}
}
}
The Retry-After header in the 429 response tells you exactly how long to wait. The SDK reads this automatically.
Other strategies to avoid 429
- Batch requests — Use the Batch API for offline workloads. 50% cheaper, no TPM limit, 24h completion window.
- Use a smaller model — GPT-4o-mini has higher rate limits than GPT-4o on the same tier. Route non-critical calls to the lighter model.
- Cache responses — Cache identical prompts + responses. Identical prompt prefixes get a 50% discount via OpenAI's prompt caching; avoid re-sending uncached prompts unnecessarily.
- Upgrade your usage tier — Limits increase automatically with spending. Tier 2 ($50 spent) quadruples most limits vs Tier 1.
- Request a manual increase — At platform.openai.com/account/limits, click "Request increase" for specific models or endpoints.
Get alerted if OpenAI has a real outage
Know instantly when 429 becomes a platform-wide 500/529 problem. Star OpenAI on Prismix for free email alerts. No credit card required.