here is what my python script looks like
here is the error in command prompt that is stumping me
{
“error”: {
“message”: “Invalid URL (POST /v1/assistants/asst_B4hduZfYuP0GwLwb1T6mhfcp/messages)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
im not the most knowledgeable with coding things in general and i had lots of help from chatgpt to get to this point so bare with me if i do any nooby things or dont understand something.
1 Like
You can’t post message in the assistant, message are created within a thread that runs using an assistant. I suggest you use the Python SDK instead, it’s easier.
Let me know if that helps,
Mart 
from openai import OpenAI
client = OpenAI()
thread_message = client.beta.threads.messages.create(
"thread_abc123",
role="user",
content="How does AI work? Explain it in simple terms.",
)
print(thread_message)
curl https://api.openai.com/v1/threads/thread_abc123/messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v1" \
-d '{
"role": "user",
"content": "How does AI work? Explain it in simple terms."
}'
1 Like