Chatgpt Assistant V2 error message

Hi,

I’m using PHP to connect to chatgpt assistant Version 2 but keep getting error:

{
“error”: {
“type”: “invalid_request_error”,
“code”: “unknown_url”,
“message”: “Unknown request URL: POST /v2/chat/completions. Please check the URL for typos, or see the docs at https://platform.openai.com/docs/api-reference/.”,
“param”: null
}
}

I’m using $postdata:

{
“model”: “gpt-4-turbo”,
“messages”: [
{
“role”: “user”,
“content”: “hi how are you?”
}
]
}

I’m using this code below:

  $ch = curl_init();
  curl_setopt_array($ch, array(
    CURLOPT_URL => 'https://api.openai.com/v2/chat/completions',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => json_encode($postData),
    CURLOPT_HTTPHEADER => array(
  	'Content-Type: application/json',
  	'Authorization: Bearer ' . $apiKey
    ),
  ));

Any ideas to why it has any issues?
Thank you so much!!

I have same error
I wanna to use api key in Next
what is the mistake?

I solved it by removing the env local baseURL, as it was the same as the installed package.