"Unknown endpoint for this model facing this issue when calling api in php thorugh GuzzleHttp

Hi i am facing this issue
Client error: POST https://api.openai.com/v1/engines/text-davinci-002/jobs resulted in a 403 Forbidden
“error”: {
“message”: “Unknown endpoint for this model.”,
“type”: “invalid_request_error”,
(truncated…)
i am calling the api through GuzzleHttp. here it is my code

try {
$client = new \GuzzleHttp\Client();
$response = $client->post(‘https://api.openai.com/v1/engines/text-davinci-002/jobs’, [
‘headers’ => [
‘Content-Type’ => ‘application/json’,
‘Authorization’ => ‘Bearer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■3RhM6p4f’,
],
‘json’ => [
‘prompt’ => ‘What is the meaning of life?’,
‘max_tokens’ => 100,
‘temperature’ => 0.5,
],
]);
} catch (\Exception $e) {
dd($e);
}
thanks for any help…

The engine endpoint has been depreciated and is now called models

Jobs is also no longer valid and you probably need to look at completion

Have a look at the API documentation in the openai pages

@raymonddavey… yes actually they use Curl but i want to use it with GuzzleHttp… and above code also generate from chatgpt… mean without Curl we cannot use?

You cannot use with any language

The engine and job urls don’t work any more

It’s not a curl vs guzzlehttp issue

@raymonddavey just last question… they provide text api like… if some one enter “10 stroy title then they provide story title in api” is it possible… thanks

Yes look at the completion endpoint for the API

You give that as a prompt and it will reply with the answer. The answer is called a completion.

It’s all on the online documentation

2 Likes