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
- Record the request's job ID and error code. Distinguish a temporary rate limit from exhausted quota or a configuration problem.
- Limit concurrent calls and use exponential backoff with jitter. Respect provider retry guidance and cap attempts and total elapsed time.
- 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
- How do I keep Claude Code following CLAUDE.md after /compact?
- How do I estimate the API cost of one completed AI task?