429 Too Many Requests / Rate limit reached
You crossed a request or token limit for your tier. The fix is backoff with jitter and batching, not a shorter sleep, and the 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 hit the token limit while sending few requests, so adding a delay between calls does nothing.
Check the response headers. They carry the remaining allowance and the seconds until reset, which is the number to sleep for - not a guess.
Notes from the author
Retry with exponential backoff and jitter. Fixed sleeps synchronise every worker you have into the same retry, which is how one rate limit becomes a stampede. Double the wait each attempt and add a random fraction.
Use the retry-after header when it is there. It is the exact number of seconds. Sleeping longer wastes throughput, sleeping less fails again.
If you hit the token limit, batch differently. Fewer, larger requests do not help - the limit is tokens. Route short tasks to a cheaper model with its own budget, or use the batch endpoint where latency does not matter.
Do not retry a 400 as if it were a 429. Malformed requests will fail forever and burn your allowance while they do.
Tagged