Urgent.News

What's breaking now, across thousands of outlets.

AI

OpenAI API Rate Limit Errors (429): Which Ones to Retry and Which Ones to Stop

Originally published on the Djangix blog: OpenAI API Rate Limit Errors (429): Which Ones to Retry and Which Ones to Stop A 429 from the OpenAI API is not one problem — it is at least two very different ones wearing the same status code, and treating them the same is how small incidents turn into long outages. The first step is to read the error code and the response headers, not just the status.…

OpenAI's API returns a 429 status code for rate limit errors, which can be confusing as it signals two different issues. The first type is a temporary overload, exceeding request or token limits. The remedy is to reduce request frequency and attempt again later. The second type pertains to quota or billing limitations, which do not resolve through retries. In such cases, the API call should cease, an alert generated, and the underlying issue addressed before retrying.

When dealing with retryable 429 errors, it is advisable to first utilize the built-in retries provided by OpenAI's official software development kits (SDKs). For more nuanced control, consider implementing exponential backoff with jitter, coupled with a cap on the number of retries to prevent all workers from retrying simultaneously when a few fail. For workloads that are heavy or bursty, employing a queue to regulate the request rate is preferable to immediate retries from each individual request.

For those handling large volumes of requests, prevention strategies prove beneficial in the long run. This includes caching and deduplicating repeated prompts, batching tasks where feasible, setting a predefined maximum number of tokens rather than allowing an unbounded count, reducing the size of the context provided, and directing straightforward jobs to a less powerful, more cost-effective model. This preserves the capacity of the primary model, preventing it from becoming overwhelmed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Nvidia-backed AI data centre firm scraps landmark listing over market fears

Artificial intelligence (AI) data centre company Firmus has scrapped its plans for what would have been one of Australia’s biggest-ever stock market listings. The Nvidia-backed firm said it had made the decision due to “recent market volatility and prevailing market conditions” and that going public would not be in the company or…

More from Friday 9 October →