Gpt-4o thread creation, getting 500 The server had an error processing your request. Sorry about that!

I’m using gpt-4o model to analyze image documents. I have an API working with no problem locally, but when it’s in production, after a day of being deployed i start getting 500 error from OpenAI server, specifically when running a thread with a file that has already been created in OpenAI.

async function createThreadAndRunWithLocalImage(fileId, content, assistantId) {
  const run = await client.beta.threads.createAndRunPoll({
    assistant_id: assistantId,
    thread: {
      messages: [
        {
          role: 'user',
          content: [
            { type: 'text', text: content },
            { type: 'image_file', image_file: { file_id: fileId, detail: 'high' } },
          ],
        },
      ],
    },
  });
  return run;
}

Being content a simple instruction and fileId the id of a file created in openAI.
The API works perfectly during the first 12 hours of deployment, but after a while being deployed, OpenAI starts responding to the requests with 500 error. We have redeployed the API and the same happens after a few hours. Also the assistants are working fine in the Playground. The error i get is

500 The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID)

Its worth mentioning that the file creation is done in the same code, and doesn’t throw an error, in fact i can see the files in my playground, so the client connection is not the problem, but the thread creation specifically.

For some context, our API used to work manually, so the request was sent when a button was pressed. We never had a problem while it worked like that. But once the request was triggered by an automatic reception of a new document, this started happening. It’s not the rate limits, since I’m only getting a few documents an hour, and have tested the API with much more load locally.

I have raised the issue of file uploads to assistants and them sometimes being problematic with OpenAI

Awaiting an answer.

2 Likes