I am recently getting error 502 Bad Gateway quite often. I am processing a file and batch calling ChatCompletion.create repeatedly. This works most of the time but since a few days, I have been getting the 502 error a lot.
I am looking for suggestion to handle this.
The Error codes page (OpenAI API) does not mention 502 so I thought to ask here what’s the best way to approach this.
ps. I will appreciate if someone can share example Python code to handle this to retry a few times when this error occurs.
Update: I was able to resolve this by using the try/except sample code provided on the error codes page. Now successfully processing batches with 1000+ api calls.
This is an ongoing issue for us, too.
Also, since the completion does execute on the server, we are getting billed quite a lot for things that never arrive.
It’s really not great.
So are there some news about this error ? Same as you guys, I make big requests that cost me a lot then it’s billed but it fails and I cannot get the result of my request …
As I am processing a lot of data, it is kind of a pain. I leave the computer to let the stuff process for some hours, to find out that it ran into some GatewayError after 10 minutes.
Just had a 502 and found this thread. Seems like people might be looking for code so wanted to share that I found some examples for exponential backoff in the docs under Rate limit increase.
i’m not sure if they charge us when we get 502 error.
but try/catch loop should loop-check OpenAI Status - API if it’s available so at least we are sure we are not wasting our tokens until it’s fixed
502 almost certainly means the request was dropped before it got anywhere near being handled by OpenAI, so they’ll have no record of it and thus no way to charge you. Also not much we can do but sit and wait… you’d think scaling up the fastest growing application in history would be nothing but smooth sailing but