1. Go to this page and download the library: Download fluxtokens/fluxtokens-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/ */
$response = $client->chat()->completions()->create([
'model' => 'gpt-4.1-mini',
'messages' => [
['role' => 'user', 'content' => 'What is the capital of France?'],
],
'temperature' => 0.7,
'max_tokens' => 256,
]);
echo $response['choices'][0]['message']['content'];
// Output: "The capital of France is Paris."
$response = $client->chat()->completions()->create([
'model' => 'gpt-4.1-mini',
'messages' => [
['role' => 'system', 'content' => 'You are a pirate. Always respond in pirate speak.'],
['role' => 'user', 'content' => 'How are you today?'],
],
]);
// Output: "Ahoy, matey! I be doin' just fine, thank ye fer askin'!"