Thread runs result into Internal Server Error 500

For context, I’m using Unity C# for development. I’m facing Error 500 when creating a Run. It works just fine on the OpenAI Playground but I’m having issues using libraries and manual implementation.

Methods I tried:

  1. Create Thread And Run
  2. Doing it separately. (i.e. Create Thread then Create Run))

Note: I have no problems on creating a Thread and adding a Message into it.

Libraries I tried:

  1. Unofficial Unity Library by RageAgainstThePixel listed in the OpenAI documentation
  2. Manual implementation using UnityWebRequests
  3. Manual implementation using System.Net.Http.HttpClient
  4. Postman tests

This is the response I get:
{ "error": { "message": "The server had an error while processing your request. Sorry about that!", "type": "server_error", "param": null, "code": null } }

Here is a minimal code for testing (manual implementation using System.Net.Http.HttpClient Create Thread And Run):

public async Task CreateThreadAndRunAsync(string message)
{
    using HttpClient client = new();

    // Set headers
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {APIKey}");
    client.DefaultRequestHeaders.Add("OpenAI-Organization",  OrganizationID);
    client.DefaultRequestHeaders.Add("OpenAI-Beta", "assistants=v1");

    string postData = $@"
        {{
            ""assistant_id"": ""{AssistantID}"",
            ""thread"": {{
                ""messages"": [
                    {{
                        ""role"": ""user"",
                        ""content"": ""{message}""
                    }}
                ]
            }}
        }}";
    StringContent content = new(postData, Encoding.UTF8, "application/json");

    try
    {
        HttpResponseMessage response = await client.PostAsync("https://api.openai.com/v1/threads/runs", content);
        string result = await response.Content.ReadAsStringAsync();
        //run = JsonConvert.DeserializeObject<Run>(result);
    }
    catch (Exception e)
    {
        Debug.LogError("Error: " + e.Message);
    }
}

P.S. I can’t include links on my post.

1 Like

I have exactly the same problem since this morning, the outage site is reporting the systems are all ok but when I try requests through API I always receive error 500

Other requests such as retrieve assistant, create thread, and create message works well for me. Just the create run doesn’t work since yesterday.

I’m having the same problem. I tried to contact support and they responded with a generic response.

I just use the Assists API, but on another account. There were no errors.

Is the problem just with our accounts?

I tried to contact support as well but didn’t get a specific answer.

Did you have the Assistants API / Threads running on your other account?

I created a new one, just for testing, a personal account.

I can execute the run(“{{URL}}threads/{{THREAD_ID}}/runs”), it is created with the status “queue”, but then changes to “failed”, because I don’t have credits in that other account.

I think it will encounter the same error once you have credits on it. I didn’t have credits beforehand and got the same error.
Now, I tried playing with the request body in both CreateThreadAndRun and CreateRun, and got a different error. So the error must be in the actual process of creating the run when everything else is correct.

Are you still experiencing the error? Do you have any response from support? It’s really strange that other people haven’t talked about this…

I am still experiencing the issue and got no updates from support.
I just gave up using Assistants API and used Chat Completions API instead. Works just fine to me.

We just tested with a new API key and there was no error.