AI Help

How do I handle AI API 429 rate limits without losing requests?

Keep requests in a durable queue and use bounded retries with backoff for recoverable rate limits. Inspect the error because quota exhaustion needs a different fix.

Steps to follow

  1. Record the request's job ID and error code. Distinguish a temporary rate limit from exhausted quota or a configuration problem.
  2. Limit concurrent calls and use exponential backoff with jitter. Respect provider retry guidance and cap attempts and total elapsed time.
  3. Persist successful results and route exhausted retries for review. Protect any downstream writes against duplicate processing.

Example in practice

Illustrative example. A batch of 100 queued jobs pauses briefly after a rate-limit response, then resumes unfinished jobs without discarding completed results.

Related AI help

Official guidance

OpenAI documentation