Skip to content

Missing OpenAI-Beta Header in Requests for Assistants API #10

@vjtaisun

Description

@vjtaisun

When trying to use the Assistants API (v2) to create a message and then run a thread stream using beta.threads.runs.stream, the following error occurs:
Stream error: {"message": "{ \"error\": { \"message\": \"You must provide the 'OpenAI-Beta' header to access the Assistants API. Please try again by setting the header 'OpenAI-Beta: assistants=v2'.\", \"type\": \"invalid_request_error\", \"param\": null, \"code\": \"invalid_beta\" } }", "type": "error", "xhrState": 3, "xhrStatus": 400}

Steps to Reproduce

  1. Initialize the OpenAI client using openai-react-native.
  2. Add a message to the thread using beta.threads.messages.create(threadId, { role: 'user', content: 'Hello' }).
  3. Run the thread using beta.threads.runs.stream(threadId, { stream: true }, onData, callbacks).
  4. The error occurs indicating the missing OpenAI-Beta header.

Expected Behavior
The API request should include the required header:
OpenAI-Beta: assistants=v2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions