OpenAI API 429 rate limit how to fix it

Your API calls are failing with "Error 429: Rate limit reached" and your production app just stopped working. This hits developers hard during peak traffic or when testing new features at scale.

OpenAI API 429 rate limit how to fix it

Your API calls are failing with "Error 429: Rate limit reached" and your production app just stopped working. This hits developers hard during peak traffic or when testing new features at scale.

What's actually happening

Error 429 means you've exceeded OpenAI's request limits for your API tier. OpenAI enforces three separate limits: requests per minute (RPM), tokens per minute (TPM), and requests per day (RPD). When you hit any of these caps, the API refuses new requests until your quota resets.

The exact limits depend on your usage tier — OpenAI automatically moves you through tiers based on how much you've spent. A new account starts at Tier 1 with 500 RPM and 200,000 TPM for GPT-4. After spending $5, you jump to Tier 2 with 5,000 RPM. Tier 5 accounts (after $1,000 spent) get 10,000 RPM and 30 million TPM. You'll see your current tier at platform.openai.com/settings/organization/limits.

The error response includes a `Retry-After` header telling you exactly how many seconds to wait. Most 429 errors clear within 60 seconds when your per-minute quota resets, but daily limits require waiting until midnight UTC.

How to fix it

1. Check your current limits

Log into platform.openai.com and click Settings → Limits in the left sidebar. You'll see your tier, current usage, and exact RPM/TPM caps for each model. If you're close to maxed out, you know why requests are failing.

2. Add exponential backoff to your code

Wrap your API calls in retry logic. When you get a 429, wait the time specified in `Retry-After`, then try again. Double the wait time with each subsequent failure, up to a maximum of 60 seconds:

```python

import time

for attempt in range(5):

try:

response = openai.ChatCompletion.create(...)

break

except openai.error.RateLimitError as e:

wait = min(2 ** attempt, 60)

time.sleep(wait)

```

This prevents hammering the API when you're rate-limited and works for temporary spikes.

3. Implement request batching

If you're sending hundreds of short requests, combine them. Send multiple prompts in a single API call using the batch endpoint at platform.openai.com/batches, or concatenate related queries into one prompt. This cuts your RPM usage dramatically without changing total token consumption.

4. Request a quota increase

Click the limits page mentioned earlier, then hit "Request quota increase" next to the model you need. Fill out the form explaining your use case, current usage patterns, and why you need higher limits. OpenAI typically responds within 2-3 business days. They're more likely to approve if you've already spent money and show consistent usage rather than sudden spikes.

5. Switch to a different model

GPT-4 has much stricter limits than GPT-3.5-turbo. If you're hitting 429s on GPT-4 and don't absolutely need its capabilities, temporarily route some requests to GPT-3.5-turbo (20,000 RPM at Tier 1). You'll stay within budget while waiting for quota increases.

If that doesn't work

Email OpenAI support through the help page at help.openai.com with these details: your organization ID (from platform.openai.com/settings/organization/general), the exact error message including timestamps, your current tier, and what you've already tried. Attach your quota increase request if you submitted one. Support typically responds in 1-3 business days for quota issues.

If you're consistently hitting limits and quota increases aren't approved, you're likely triggering their abuse detection. Sudden usage spikes from new accounts look suspicious. The solution: increase spending gradually over weeks rather than days. For more complex API errors beyond rate limits, check our complete troubleshooting guide.

Need immediate help? The official contact paths for urgent production issues are limited, but enterprise customers get faster responses.

Questions people actually ask

Q: How long until my rate limit resets?

A: RPM and TPM limits reset every 60 seconds. Daily limits (RPD) reset at midnight UTC. Check the `Retry-After` header in the error response for exact timing.

Q: Can I pay to instantly increase my limits?

A: No. Limits are tied to usage tiers based on historical spending, not a one-time payment. You must spend $5 to reach Tier 2, $50 for Tier 3, and so on over your account lifetime.

Q: Why am I getting 429 errors when I'm not making that many requests?

A: You're probably hitting TPM (token) limits, not RPM. A single request with a 10,000-token conversation uses 10,000 of your 200,000 TPM budget. Twenty such requests in one minute trigger the limit even though that's only 20 RPM.

What to remember

  • Check platform.openai.com/settings/organization/limits to see your exact tier and current usage
  • Add exponential backoff with `Retry-After` header checking to all API calls
  • Batch multiple requests together to reduce RPM consumption
  • Request quota increases with specific use cases and usage history
  • Switch to GPT-3.5-turbo temporarily if GPT-4 limits are blocking production

---

*openai-support.com is an independent resource, not affiliated with OpenAI Inc.*

Related help