Facing issue with creating a thread in Open AI using rest api in c#

You seem to have conflation of v1 header and v2 methods. Also that you are likely sending a file content but no file name.

I would develop using v2 file search, not v1 retrieval, as the v1 API will be the first to go in December (and the methods of retrieval are expensive document navigation by AI).

Full headers to use, as sending project also is especially important for data scoping:

OpenAI-Beta: assistants=v2
Authorization: Bearer $OPENAI_API_KEY
OpenAI-Organization: OPENAI_ORG_ID
OpenAI-Project: $OPENAI_PROJECT_ID

Then files that will be attached to a user message are simply references to a file_id that you’ve already uploaded to your account file storage. That is where the file name is important to also send with MIME, along with the “assistants” file purpose.

2 Likes