API Query - Engines for GPT-4?

What do I have to do to make use of GPT-4 ? This is what I currently have :

use GuzzleHttp\Client;
$client = new Client(['base_uri' => 'https://api.openai.com', 'timeout'  => 10.0,]);

$response = $client->post('/v1/engines/text-davinci-003/completions', [
    'headers' => [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer ' . $openai_api_key,
        ],
    'json' => [   
        'prompt' => $prompt,
        'max_tokens' => 2048,
        'n' => 1,
        'stop' => null,        
        'temperature' => 1,
        ],
]);

See the GPT Guide.

You can also try this PHP library

1 Like

Thanks for letting me know about the PHP library. Though, I can’t seem to use gpt-4 or gpt-3.5-turbo for $client->completions()->create

Those are chat models, so you need to use the chat() endpoint with the chat message format.