429 Too Many Requests / Rate limit reached
You crossed a request or token limit for your tier. Backoff with jitter and batching fix it. A shorter sleep does not, and the response header tells you which limit you hit.
Tested on GPT-5 ·
RateLimitError: Rate limit reached for gpt-5 in organization org-xxx on tokens per min (TPM): Limit 30000, Used 29981, Requested 1200. Please try again in 2.362sTwo limits exist and the message rarely says which one you hit: requests per minute and tokens per minute. Long prompts reach the token limit with only a few requests, so a delay between calls changes nothing.
Read the response headers. They carry the remaining allowance and the seconds until reset, and that is the number to sleep for. Do not guess.
Notes from the author
Retry with exponential backoff and jitter. Fixed sleeps line every worker up on the same retry, and that is how one rate limit turns into a stampede. Double the wait on each attempt and add a random fraction.
Use the retry-after header when it is there. It gives the exact number of seconds. Sleep longer and you waste throughput, sleep less and you fail again.
If you hit the token limit, batch differently. Fewer, bigger requests do not help, because the limit counts tokens. Send short tasks to a cheaper model with its own budget, or use the batch endpoint where speed does not matter.
Never retry a 400 as if it were a 429. A malformed request fails forever and burns your allowance while it does.
For information only, not professional advice. You use it at your own risk and we are not liable for any loss or damage. See the disclaimer.
Tagged