Hello,
I am having trouble accessing my custom assistant via the OpenAI API using PowerShell. I have confirmed that my API key, Assistant ID, and the format of my request are correct. I have also verified that my assistant is properly set up and active.
Here’s the PowerShell command I’m using:
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Bearer {API_KEY}"
}
$body = @{
"messages" = @(
@{
"role" = "user"
"content" = "This is a test message for the custom assistant"
}
)
} | ConvertTo-Json
$response = Invoke-WebRequest `
-Uri "https://api.openai.com/v1/assistants/{ASSISTANT_ID}/messages" `
-Method Post `
-Headers $headers `
-Body $body `
-UseBasicParsing
$response.Content
(Note: {API_KEY}
and {ASSISTANT_ID}
are placeholders for my actual API key and Assistant ID.)
When I run this command, I receive the following error:
Invoke-WebRequest : {
"error": {
"message": "Invalid URL (POST /v1/assistants/{ASSISTANT_ID}/messages)",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
I have successfully connected to the general model endpoint using PowerShell, and I can list all the assistants available to me. However, when I try to connect to my custom assistant, I get the “Invalid URL” error.
I have reviewed the configuration of my assistant in the OpenAI dashboard and everything seems to be in order. I’m not sure what else could be causing this issue.
Any help would be greatly appreciated. Thank you!