ierfi
February 9, 2023, 4:13pm
1
I get this error when using the following code
{ “error”: { “message”: “Unknown endpoint for this model.”, “type”: “invalid_request_error”, “param”: null, “code”: null } }
code :
<?php
$curl = curl_init();
$url = 'https://api.openai.com/v1/engines/text-davinci-003/jobs';
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
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 =>"{
\"prompt\": \"What is OpenAI?\",
\"temperature\": 0.5,
\"max_tokens\": 100,
\"top_p\": 1,
\"frequency_penalty\": 0,
\"presence_penalty\": 0
}",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer sk-Xxxxxxxxxxxxxxxxxxxxxx",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
where is the problem from ?
1 Like
That’s your problem… deprecated … new URL is in the docs…
Hope that helps!
2 Likes
I couldn’t find that url.
You will want the “completions” endpoint. OpenAI API
1 Like
I get this problem too,would you please offer the new URL? I founded no answer in the docs
Here ya go… @dexterpackey53
OpenAI API: Create Completion
Not sure why you cannot find it, TBH. A google search brings it up very quickly.
Literally the post above answered it lol
I wonder sometimes if we’re being trolled …
3 Likes
Yeah, I’m starting to feel “troll fatigue” here as well, TBH. Time to take a short break!
Need a break…,
1 Like
We need an ai to answer questions. Any idea where we can find one
2 Likes
I wrote a Discourse OpenAI plugin but I this is a Discourse hosted forum so Discourse will charge OpenAi extra to run it here.
thank your answer,I just wonder a little about chatgpt answer of how to run the chatgpt api do not work,from your answer,I guess the url of running api is changed to completions,is it right?
dexterpackey53:
chatgpt api
There is currently NO chatgpt api…
so,if I want to realize a chat application by using openai api,which api should I choose?or actually there is no api can be used?
Have you read the docs?
Good place to start to learn!
1 Like