1. Go to this page and download the library: Download hexgenerative/ai 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/ */
hexgenerative / ai example snippets
HexaGenerative\HexaAI;
$client = new HexaAI('hgx-your-api-key');
$response = $client->chat->completions->create([
'model' => 'hexa-pro',
'messages' => [
['role' => 'user', 'content' => 'Hello, who are you?']
]
]);
echo $response->getContent();