HTTP/1.1 502 Bad Gateway - suddenly started to be raised

Observed now often this error. Is there something going on today? It was not the case yesterday.

Got this from our log:
2024-09-12 16:22:17,441 - httpx - INFO
HTTP Request: POST …//…/v1/chat/completions “HTTP/1.1 502 Bad Gateway”
I’m using latest version of Python apenai library. 1.44.1

1 Like

Gateway errors are a sign that some intermediary service is failing to process your requests, this is typically a transient issue that will resolve itself.

If your code correctly handles and retries these issues you should be good to go, keep an eye on the error rate and try to map out the frequency vs time of day, day of week, month etc, to get an idea as to the frequency.

You can report these to help.openai.com and the bot in the bottom right corner if you wish, but there is little that can be done if the errors are only intermitted and simply part of being connected to a very busy server cluster.