OpenAI API error 429 rate limit exceeded fix
You're building with the OpenAI API and suddenly hit a wall: Error 429: Rate limit reached for requests. Your code stops working, requests start failing, and you're stuck wondering how to get unblocked.
OpenAI API error 429 rate limit exceeded fix
You're building with the OpenAI API and suddenly hit a wall: `Error 429: Rate limit reached for requests`. Your code stops working, requests start failing, and you're stuck wondering how to get unblocked.
What's actually happening
Error 429 means you've exceeded the rate limits OpenAI sets on your API account. Every API tier has limits on requests per minute (RPM), tokens per minute (TPM), and tokens per day (TPD). When you cross those thresholds, OpenAI's servers reject additional requests until your usage window resets.
The exact limits depend on your usage tier. Free tier accounts get minimal limits — often just 3 RPM and 40,000 TPM on GPT-3.5. Tier 1 (after your first $5 payment) increases to 500 RPM and 200,000 TPM. Higher tiers unlock millions of tokens per minute, but you need sustained payment history to qualify.
The error response usually includes details like `"type": "requests"` or `"type": "tokens"` to tell you which limit you hit. Sometimes you'll see the actual numbers: "Rate limit reached for gpt-4 in organization org-xyz on requests per min: Limit 10, Used 10, Requested 1." That tells you exactly what broke.
How to fix it
1. Check your current rate limits
Log into platform.openai.com and go to Settings → Limits. You'll see your exact RPM, TPM and TPD limits for each model. Compare these numbers to what your code is requesting.
2. Add exponential backoff to your code
Don't just retry immediately when you hit 429. Implement exponential backoff — wait 1 second, then 2, then 4, then 8 before retrying. Most API libraries support this automatically. In Python with the OpenAI SDK:
```python
from openai import OpenAI
client = OpenAI(max_retries=3)
```
The SDK will handle 429 errors and retry with backoff automatically.
3. Batch requests and reduce frequency
If you're making 100 requests in quick succession, spread them out. Add delays between calls. Use the Batch API for non-urgent workloads — it costs 50% less and doesn't count against rate limits the same way. Check the API error documentation for batching examples.
4. Request a rate limit increase
Go to Settings → Limits on platform.openai.com and click "Request limit increase" next to the model you need. Fill out the form with your use case details and current spending. OpenAI reviews these manually, usually within 2-3 business days. Be specific about why you need higher limits and what you're building.
If you're on Tier 0 (free), you won't qualify for increases until you've spent at least $5 and been active for 7 days. Pay for some usage first, then request.
If that doesn't work
Check if you're actually on the tier you think you are. Sometimes payment issues drop you back to Tier 0 limits without warning. Go to Settings → Billing and verify your payment method is active and you've successfully been charged.
If you've implemented backoff and are still consistently hitting limits, you might have a code bug creating runaway requests. Add logging to count exactly how many requests you're making per minute. Often there's a loop or webhook firing far more than expected.
For urgent production issues, contact OpenAI through the official support channels with your organization ID and specific error logs. Include the exact `x-ratelimit-*` headers from failed requests — these show OpenAI's backend exactly what happened. Expect 24-48 hour response times unless you're on an enterprise plan.
Questions people actually ask
Q: Can I pay extra to skip rate limits immediately?
A: No. Rate limits exist for all tiers. You can qualify for higher tiers faster by spending more, but there's no "pay to bypass" option.
Q: Why did my limits suddenly decrease?
A: Usually payment issues or unexpected charges that put your account in review. Check Settings → Billing for declined cards or unpaid invoices.
Q: Do rate limits reset every 60 seconds exactly?
A: They use a sliding window. If you hit 500 RPM at 2:00:37pm, you need to wait until 2:01:37pm before that request window resets. It's not on the minute mark.
Q: Does the Batch API have the same limits?
A: No. Batch API has separate, much higher limits and processes jobs asynchronously. Great for large workloads that aren't time-sensitive.
What to remember
- Check your exact limits at platform.openai.com Settings → Limits before assuming what they are
- Always implement exponential backoff in production code — never retry 429 errors immediately
- Tier 0 accounts get minimal limits until you spend $5 and wait 7 days
- Rate limit increases require manual review and take 2-3 business days
- The `x-ratelimit-*` response headers show exactly which limit you hit and when it resets
---
*openai-support.com is an independent resource, not affiliated with OpenAI Inc.*