OpenAI API 429 rate limit how to fix
You're hitting error 429 when calling the OpenAI API — your requests are being blocked because you've exceeded your rate limits. This happens to developers running production apps, testing new features, or processing lar
OpenAI API 429 rate limit how to fix
You're hitting error 429 when calling the OpenAI API — your requests are being blocked because you've exceeded your rate limits. This happens to developers running production apps, testing new features, or processing large batches of requests without proper rate handling.
What's actually happening
When you see error 429, OpenAI's API is rejecting your request because you've sent too many in a short window. The full error looks like this:
```
Error code: 429 - {'error': {'message': 'Rate limit reached for requests', 'type': 'tokens', 'param': null, 'code': 'rate_limit_exceeded'}}
```
OpenAI enforces two types of rate limits: requests per minute (RPM) and tokens per minute (TPM). Free tier accounts get severely restricted limits — often 3 RPM and 40,000 TPM for GPT-3.5. Paid accounts with usage history get higher limits that scale based on your payment tier and how much you've spent historically.
The limits aren't just about your total usage — they're calculated in rolling windows. Send 60 requests in 10 seconds? You'll hit the RPM limit even if you wait the rest of the minute. The API also counts tokens in both your prompt and the completion, so a single long conversation can burn through TPM faster than dozens of short requests.
How to fix it
1. Check your current rate limits
Go to platform.openai.com/account/limits. You'll see exact numbers for each model — GPT-4, GPT-3.5-turbo, embeddings, etc. Note both RPM and TPM for the models you're using.
2. Implement exponential backoff
When you hit 429, don't immediately retry. Wait 1 second, then 2, then 4, doubling each time up to a maximum wait of 60 seconds. Here's the pattern:
```python
import time
for attempt in range(5):
try:
response = client.chat.completions.create(...)
break
except openai.RateLimitError:
wait = min(60, (2 ** attempt))
time.sleep(wait)
```
3. Add request throttling
Track how many requests you're sending per minute. If you know your RPM limit is 60, space requests at least 1 second apart. For batch processing, add a delay between API calls — even 0.5 seconds can prevent rate limit errors.
4. Reduce token usage per request
Check token counts in your prompts. A system message, conversation history, and response can easily hit 2,000+ tokens. Trim old messages from context, use shorter system prompts, and set max_tokens to limit completion length. Every 1,000 tokens you save means more requests within your TPM limit.
5. Upgrade your usage tier
Paying for more API credits automatically increases your limits. Platform.openai.com/account/billing shows your usage tier. Spending $50+ often unlocks 10x higher rate limits. You can also request a limit increase through platform.openai.com/account/limits by clicking "Request increase" next to any model, though approval isn't guaranteed.
If that doesn't work
Check if you're seeing a different OpenAI API error 429 variation — insufficient_quota means you've run out of credits entirely, not just hit rate limits. That requires adding payment method or topping up your account.
If you genuinely need higher limits for production use, contact OpenAI through platform.openai.com/account/limits. Include your use case, expected request volume, and current limitations. Provide your organization ID (found in platform.openai.com/account/organization). Response times average 3-5 business days. See how to contact OpenAI support for what details to include.
For urgent production issues where 429 errors are breaking live services, some developers temporarily split load across multiple API keys under different organizations. This isn't officially recommended but works when you're stuck.
Questions people actually ask
Q: Why am I getting 429 on my first request of the day?
A: Rate limits are per-minute rolling windows, but if your account hasn't been used in 30+ days or you just created it, OpenAI sometimes applies stricter initial limits. Make a few successful requests over several days to establish usage history.
Q: Do different models share the same rate limit?
A: No. GPT-4 has separate limits from GPT-3.5-turbo, which has separate limits from embeddings. You can hit 429 on GPT-4 while GPT-3.5-turbo works fine.
Q: Can I pay to remove rate limits entirely?
A: No. Even enterprise accounts have rate limits — they're just much higher. If you see unexpected charges while hitting rate limits, check your unexpected OpenAI charge guide.
What to remember
- Error 429 means too many requests or tokens per minute — not account suspension or billing issues
- Check exact limits at platform.openai.com/account/limits for each model you're using
- Implement exponential backoff with 1-2-4-8 second waits between retries
- Reduce tokens per request by trimming context and limiting max_tokens
- Higher payment tier = higher automatic rate limits, or request manual increase through the limits page
---
*openai-support.com is an independent resource, not affiliated with OpenAI Inc.*