openai.NotFoundError: Error code 404, python cant find assistant

I have copied my api key from playground and copied my assistants ID from the website so a spelling erorr is out of the question, ive even tried to make a new assitant and it had the same error for me. I use OpenAI version 1.37
The problem is it acts as if the ai dosent exist. and it definiteley does. there is money on the account so it should work.

My code:
from openai import OpenAI

client = OpenAI(api_key=“api key”)
def ask_my_assistant(prompt):
response = client.completions.create(model=“my assistant”, # Replace with your assistant’s ID
return response.choices[0].text.strip()

Example usage

response = ask_my_assistant(“Hello, how can I help you today?”)

I get this error:
openai.NotFoundError: Error code: 404 - {‘error’: {‘message’: ‘The model asst_xxxxxxxxxxxxxxxx does not exist’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘model_not_found’}}


Was this ever resolved? I feel like I have everything nailed down but continued to get error as if the assistant does not exist.


I have the exact same issue: I can create a client. The chat completion API works fine. But when I try to create an assistant, it gives me a “NotFoundError: Error code: 404 - {‘error’: {‘code’: ‘404’, ‘message’: ‘Resource not found’}}”

Any help would be appreciated!

For those running into the same issue: I updated the API version to “2024-02-15-preview”, which solved my issue.

I am currently utilizing Flask with the request module, and all IDs appear to be functioning correctly. However, when attempting to make a request via a client (such as a website) to the OpenAI assistant, it consistently fails:

:2024-03-10 16:00:55,290 - INFO - - - [10/Mar/2024 16:00:55] “OPTIONS /ask HTTP/1.1” 200 -

2024-03-10 16:00:55,794 - INFO - Response from OpenAI API for thread creation: 200 - {‘id’: ‘thread_ViOf8KzAoSLI7CGyjEfmBPOG’, ‘object’: ‘thread’, ‘created_at’: 1710079255, ‘metadata’: {}}

2024-03-10 16:00:56,161 - INFO - Response from OpenAI API for adding message to thread: 404 - {‘error’: {‘type’: ‘invalid_request_error’, ‘code’: ‘unknown_url’, ‘message’: ‘Unknown request URL: POST /v1/2024-02-15-preview/assistants/OPENAI_ASSISTANT_ID/messages. Please check the URL for typos, or see the docs at ht…://’, ‘param’: None}}

2024-03-10 16:00:56,162 - ERROR - Error from OpenAI API: 404 Client Error: Not Found for url: ht…://

2024-03-10 16:00:56,165 - INFO - - - [10/Mar/2024 16:00:56] “[35m[1mPOST /ask HTTP/1.1[0m” 500 -

what an i doing wrong?