Try it out since hours, ask the GPT-Bot (and he is amazing helpful), read the documentation, but I can’t find my problem…
output: {
"error": {
"message": "you must provide a model parameter",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
The model-parameter looks completely OK in my Script.
Here my script (just the relevant part - PHP via CURL):
$api_key = 'my-secret-api-key';
$api_endpoint = 'https://api.openai.com/v1/completions';
$api_params = array(
'model' => 'text-davinci-003',
'prompt' => 'Hello?',
'temperature' => 0.9,
'max_tokens' => 150,
'frequency_penalty' => 0,
'presence_penalty' => 0.6,
'organization' => 'org-my-organization-ID'
);
$api_query = http_build_query($api_params);
$iCurlTimeout = 120;
$ch = curl_init();
// CURL-Optionen
curl_setopt($ch, CURLOPT_URL, $api_endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $iCurlTimeout);
curl_setopt($ch, CURLOPT_POSTFIELDS, $api_query);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-type: application/x-www-form-urlencoded",
"Authorization: Bearer $api_key"
));
$api_response = curl_exec($ch);
print "<pre>output: "; print_r($api_response); print "</pre>";
curl_close($ch);
Secret key and organization ID are changed.
I check out api_params, endpoint, try a new API key, bring the organization into the request, because I set the Default organization to our organization name, try it with the organization name, also with the ID, also check out the authorization in the header - everything looks OK.
But I get all the time the same error-message.
By the way, I try also out to send an request about my secret key to get a list of the models - that works fine.
Do anybody see the problem?
cooper