Periodically, I get the 500 error on a post request to https://api.openai.com/v1/audio/transcriptions.
It is working most of the time, but now and again it gives the 500 error. Could this be due to 2 different customers call it at roughly the same time?
How can I get around this if that is the case?
Thank you
You need to set retry and timeout in the openai library you are using.
Here’s the one for node:
Certain errors will be automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default.
// Configure the default for all requests:
const openai = new OpenAI({
maxRetries: 0, // default is 2
});
// Or, configure per-request:
await openai.chat.completions.create({ messages: [{ role: 'user', content: 'How can I get the name of the current day in Node.js?' }], model: 'gpt-3.5-turbo' }, {
maxRetries: 5,
});