OpenAI API error 429, 401, 500, and 503 — what each means and how to fix them fast
Your API call just died with a cryptic three-digit code. Whether you're building a chatbot, processing documents, or running automated tasks, these four errors stop everything cold — and each one needs a different fix.
OpenAI API error 429, 401, 500, and 503 — what each means and how to fix them fast
Your API call just died with a cryptic three-digit code. Whether you're building a chatbot, processing documents, or running automated tasks, these four errors stop everything cold — and each one needs a different fix.
What's actually happening
Error 429: Rate limit exceeded
You've hit OpenAI's speed limit. Every API tier has maximum requests per minute (RPM) and tokens per minute (TPM). Free tier gets 3 RPM and 40,000 TPM on GPT-4. Tier 1 (after $5 spend) jumps to 500 RPM and 30,000 TPM. Send requests too fast and you get `{"error": {"code": "rate_limit_exceeded"}}`.
This isn't about your total usage — it's about how fast you're sending requests right now.
Error 401: Authentication failed
Your API key is wrong, revoked, or missing. The full error says `"error": {"code": "invalid_api_key"}` or `"Incorrect API key provided"`. Either you're using an old key you deleted, pasted it wrong, or forgot to include it in the header.
Error 500: Internal server error
OpenAI's servers broke mid-request. You'll see `{"error": {"type": "server_error"}}` or just a plain 500 status. This is on their end — a database hiccup, model timeout, or infrastructure glitch. Rare but it happens.
Error 503: Service unavailable
OpenAI's systems are overloaded or down for maintenance. The response might say `"The server is overloaded or not ready yet"`. During peak hours (US mornings, weekday afternoons) this spikes. Major outages show up at status.openai.com.
How to fix it
For 429 rate limits:
- Check your current tier at platform.openai.com/settings/organization/limits — scroll to "Rate limits" and see your actual RPM/TPM numbers
- Add exponential backoff to your code. Wait 1 second after the first 429, then 2, 4, 8 seconds. Python example:
```python
import time
for attempt in range(5):
try:
response = openai.ChatCompletion.create(...)
break
except openai.error.RateLimitError:
time.sleep(2 ** attempt)
```
- Batch requests if you're processing multiple items — send one API call with multiple messages instead of rapid-fire individual calls
- Upgrade your tier by spending $50 total to reach Tier 2 (5,000 RPM) or submit a rate limit increase request at platform.openai.com/settings/organization/limits (click "Request increase")
If you're already at a high tier and still hitting limits, you're genuinely sending too much traffic for your allocation.
For 401 authentication:
- Go to platform.openai.com/api-keys and verify your key exists and shows "Active"
- Copy it fresh — click the key name, regenerate if needed
- Check your code uses the header `Authorization: Bearer sk-proj-...` (not `Api-Key` or `X-API-Key`)
- Test with curl: `curl https://api.openai.com/v1/models -H "Authorization: Bearer YOUR_KEY"` — if this fails, the key is definitely broken
- Create a new key if regenerating doesn't work, then revoke the old one
For 500 and 503 errors:
- Retry immediately — 70% of 500 errors succeed on retry number two
- Check status.openai.com for ongoing incidents (bookmark this)
- Reduce your request complexity — use `gpt-3.5-turbo` instead of `gpt-4`, cut context length, remove function calling temporarily
- Wait 60 seconds if you get three consecutive 500s, then retry with a simpler request
If that doesn't work
For persistent 429s: Email api-help@openai.com with your organization ID (from platform.openai.com/settings/organization/general) and current tier. Explain your use case — "Processing customer support tickets, need 800 RPM instead of 500". They typically respond in 2-3 business days.
For stuck 401s: Confirm you're using the right OpenAI account. Check if your billing is current at platform.openai.com/settings/organization/billing — suspended accounts get authentication errors. Include your last working API call timestamp when contacting support.
For endless 500/503s: Switch to a different model temporarily. If `gpt-4-turbo-preview` keeps failing, use `gpt-4-0613` or `gpt-3.5-turbo-16k`. Check the OpenAI community forum at community.openai.com — if everyone's seeing 503s, you just wait it out.
Questions people actually ask
Q: Can I pay to skip rate limits entirely?
A: No. Even Tier 5 accounts (which require $1,000+ in monthly spend) have limits — just much higher ones like 10,000 RPM. Rate limits prevent abuse and ensure system stability.
Q: Why do I get 429 errors when my usage page shows I'm nowhere near my monthly quota?
A: Monthly quota and rate limits are different. You might have 500,000 tokens left this month but still hit the 500 requests-per-minute wall if you send 600 requests in 60 seconds.
Q: Do 500 errors count against my rate limit?
A: No. Failed requests don't consume your quota or count toward RPM limits. Only successful 200 responses count.
Q: How long do 503 errors typically last?
A: During normal load spikes, 5-20 minutes. Actual outages (rare) last 1-4 hours. Follow @OpenAIStatus on Twitter for real-time updates.
What to remember
- 429 means you're going too fast — add retry logic with exponential backoff
- 401 means check your API key at platform.openai.com/api-keys — regenerate if needed
- 500 errors are temporary — just retry the exact same request twice
- 503 means OpenAI's overloaded — check status.openai.com before panicking
- Rate limits are per-minute, not per-month — space out your requests
---
*openai-support.com is an independent resource, not affiliated with OpenAI Inc.*