PHP code example of yunzhiyike / chat-gpt

1. Go to this page and download the library: Download yunzhiyike/chat-gpt 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/ */

    

yunzhiyike / chat-gpt example snippets




declare(strict_types=1);
/**
 * This file is part of Yunzhiyike
 */

namespace Yunzhiyike\Test;

use PHPUnit\Framework\TestCase;
use Yunzhiyike\ChatGpt\ChatGptFactory;
use Yunzhiyike\ChatGpt\constans\GptV1Model;

/**
 * @internal
 * @coversNothing
 */
class TestA extends TestCase
{
    public function test()
    {
        $res = ChatGptFactory::getInstance()->gptV1->sendText('给我画一幅美丽的风景图', GptV1Model::GTP_4O, 'http://账号:密码@IP:端口');
        var_dump($res);
    }
}