Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backoff when OpenAI returns 5xx #354

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tinco
Copy link

@tinco tinco commented Apr 3, 2025

Hi! Thanks for creating and maintaining async-openai. I noticed during the outtages last weekend that the client is not dealing with server errors as is instructed by OpenAI.

I'm fairly certain these are new instructions, on this page you can see:

https://platform.openai.com/docs/guides/error-codes

That they are now advising to retry (after a delay) on any server error.

It is slightly more involved than that, because I also noticed that it is sometimes (always?) the case that they do not return JSON on server errors, so instead of parsing JSON, we need to create the ApiError ourselves by simply inserting the whole response body into the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant