PHP code example of fnadalrod / chatgpt-open-api-wrapper

1. Go to this page and download the library: Download fnadalrod/chatgpt-open-api-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fnadalrod / chatgpt-open-api-wrapper example snippets

 php
$config = [
    "http_client" => "guzzle",
    "api_key" => "****",
    "engine" => "gpt-3.5-turbo"
];

$openApiClient = new OpenApiClient($config);
$openApiResponse = $openApiClient->prompt('Is it working?');

echo $openApiResponse->getLastResponse();