PHP code example of itquelle / open-ai-chatgpt-php

1. Go to this page and download the library: Download itquelle/open-ai-chatgpt-php 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/ */

    

itquelle / open-ai-chatgpt-php example snippets


$app->setOptionModel(...);
$app->setOptionTemperature(...);
$app->setOptionMaxTokens(...);
$app->setOptionTopT(...);
$app->setOptionFrequencyPenalty(...);
$app->setOptionPresencePenalty(...);

var_dump(
    $app->getResponseRaw()
);



use OpenAiApi\Api;

$app = new Api(...);
$app->setPrompt("Translate this into 1.English, 2.French: Hallo");
$app->get();

echo $app->getResponseText();

$ composer