Hello everyone,
I hope someone here can help me. I have created and trained a custom GPT model, and now I want to access it via the API. I am using the OpenAI API and already have a ChatGPT Plus membership. Here are the details of my current situation:
My current cURL request:
?php
// Initializing cURL
$ch = curl_init();
$gpt_api_url = "https://api.openai.com/v1/chat/completions"; // Replace with the actual API URL for my custom model
$gpt_api_key = "your_api_key"; // Replace with my actual API key
// Preparing data for the request
$json_data = json_encode([
"model" => "my_custom_model", // Replace with the name of my custom model
"messages" => [
[
"role" => "user",
"content" => "Please provide a detailed response to a business email where I am canceling a meeting." // Clear and specific prompt
]
],
"max_tokens" => 150 // Number of desired tokens
]);
curl_setopt($ch, CURLOPT_URL, $gpt_api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer ' . $gpt_api_key
]);
// Executing the request and storing the response
$response = curl_exec($ch);
// Checking for errors
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
// Processing the response
$response_data = json_decode($response, true);
print_r($response_data);
}
// Closing the cURL session
curl_close($ch);
?>
type or paste code here
The problem:
I am getting the following error message:
Array ( [error] => Array ( [message] => The model my_custom_model
does not exist or you do not have access to it. [type] => invalid_request_error [param] => [code] => model_not_found ) )
My questions:
-
Do I need special permissions to access my custom model?
-
Do I need a special API endpoint for custom models?
-
Are there additional steps or settings I need to check to ensure my model is available and accessible?
I have already made sure that my model is correctly created and deployed and that I am using the correct API key.
Thanks in advance for your help!
Best regards,