OpenAI API 429 error how to fix rate limits
You're getting a 429 error from the OpenAI API, and your requests are being rejected. This happens when you've hit your rate limit — OpenAI's system is blocking you because you're sending too many requests too fast or co
OpenAI API 429 error how to fix rate limits
You're getting a 429 error from the OpenAI API, and your requests are being rejected. This happens when you've hit your rate limit — OpenAI's system is blocking you because you're sending too many requests too fast or consuming too many tokens per minute.
What's actually happening
A 429 error means you've exceeded one of OpenAI's usage limits. The actual error message usually looks like this:
```
Error code: 429 - {'error': {'message': 'Rate limit reached for requests', 'type': 'requests', 'param': null, 'code': 'rate_limit_exceeded'}}
```
OpenAI enforces several types of limits simultaneously. You might hit your requests per minute (RPM) limit — that's how many API calls you can make in 60 seconds. Or you might exceed your tokens per minute (TPM) limit — the total number of input and output tokens processed per minute. There's also a tokens per day (TPD) limit on some tiers.
Your specific limits depend on your usage tier. New free-tier accounts might have RPM limits as low as 3 requests per minute. Paid tier 1 accounts typically get 500 RPM and 30,000 TPM for GPT-3.5, while tier 5 accounts can reach 10,000 RPM. The error response sometimes includes a `Retry-After` header telling you exactly how many seconds to wait, but not always.
How to fix it
1. Check your current limits
Go to platform.openai.com/settings/organization/limits. You'll see your exact RPM, TPM, and TPD limits for each model. This shows you where you stand and which limit you actually hit.
2. Add exponential backoff to your code
The fastest fix is implementing retry logic. When you get a 429, wait a few seconds and try again. Here's the pattern:
```python
import time
import openai
max_retries = 5
for attempt in range(max_retries):
try:
response = openai.ChatCompletion.create(...)
break
except openai.error.RateLimitError:
if attempt < max_retries - 1:
wait_time = (2 ** attempt) + random.random()
time.sleep(wait_time)
else:
raise
```
This waits 1 second, then 2, then 4, then 8 seconds between retries. Most 429 errors resolve within 60 seconds.
3. Batch your requests differently
If you're processing multiple prompts, spread them out instead of sending them all at once. Add a `time.sleep(1)` between requests, or use a queue system that respects your RPM limit. If you need higher throughput, the Batch API lets you submit up to 50,000 requests at once with 50% lower costs — but responses come back in 24 hours, not real-time.
4. Request a tier increase
OpenAI automatically moves paid accounts to higher tiers based on usage and payment history. You can't manually request tier upgrades, but after 7 days of consistent usage and $50+ spent, you typically move from tier 1 to tier 2. Each tier roughly doubles your limits. Check platform.openai.com/settings/organization/limits to see when you qualify for the next tier.
5. Switch to a higher-capacity model endpoint
Some models have different limits. GPT-4 typically has lower RPM limits than GPT-3.5-turbo. If you're prototyping and hitting limits on GPT-4, test your logic with GPT-3.5-turbo first — it has 10x higher rate limits on most tiers.
If that doesn't work
If you're still stuck after implementing backoff and hitting limits on a paid account, you might have a billing issue. Check platform.openai.com/account/billing/overview to confirm your payment method is valid and you haven't hit your monthly budget cap.
For persistent 429 errors that don't match your displayed limits, contact OpenAI support through platform.openai.com/account/support. Include your organization ID (found in settings), the exact timestamp of failed requests, and your current tier. They can investigate backend issues, but response times run 2-5 business days for rate limit questions.
If you're seeing 429 errors alongside messages about insufficient_quota, that's a different problem — it means you've run out of credits entirely, not that you're just going too fast.
Questions people actually ask
Q: Why am I getting 429 on my first request of the day?
A: You might be hitting TPD (tokens per day) limits from yesterday's usage, or your account has a billing hold. Check your usage dashboard at platform.openai.com/usage.
Q: Does the free tier even work for real applications?
A: The free tier (3 RPM, 40,000 TPM on GPT-3.5) is for testing only. Any production app needs at least tier 1, which requires adding a valid payment method.
Q: How long until my rate limit resets?
A: RPM and TPM limits reset every 60 seconds on a sliding window. TPD limits reset at midnight UTC. The counter isn't on an hourly schedule — it tracks your last 60 seconds or 24 hours of usage.
What to remember
- Check platform.openai.com/settings/organization/limits for your exact current limits per model
- Implement exponential backoff with 1-2-4-8 second waits between retries
- Spread requests out over time instead of bursting them all at once
- Paid tiers automatically increase after consistent usage and spending
- The Batch API offers 50% cost savings if you can wait 24 hours for results
---
*openai-support.com is an independent resource, not affiliated with OpenAI Inc.*