OpenAI Python SDK retries transient errors automatically; developers must handle the rest
The OpenAI Python SDK automatically retries connection problems, timeouts, rate-limit errors (429), and 5xx server errors using exponential backoff. Errors such as malformed requests (400), bad credentials (401/403), and missing resources (404) are not retried, since repeating them would fail again. Developers are responsible for setting suitable timeouts, handling non-retryable errors in their own code, and logging request IDs for tracing failures. The default timeout of 10 minutes suits long reasoning tasks but is too long for interactive web use, so a shorter timeout is recommended there. Because each retry can add another full timeout, the worst-case wait equals the timeout multiplied by the number of retries plus one.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in