PHP code example of phaseo / sdk

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

    

phaseo / sdk example snippets




declare(strict_types=1);

 = new Phaseo(
    apiKey: getenv('PHASEO_API_KEY') ?: null,
    basePath: getenv('PHASEO_BASE_URL') ?: 'https://api.phaseo.app/v1',
);

$response = $client->createResponse([
    'model' => 'google/gemma-3-27b:free',
    'input' => 'Reply with: PHP SDK works',
]);

echo json_encode($response, JSON_PRETTY_PRINT) . PHP_EOL;

$report = $client->checkModelParameters("openai/gpt-5.4", ["temperature" => 0.7], ["endpoint" => "responses"]);
$preflight = $client->preflightRequest(["model" => "openai/gpt-5.4", "input" => "Hello", "temperature" => 0.7], ["endpoint" => "responses"]);

$models = $client->listModels([
    'provider' => 'anthropic',
    'provider_status' => 'beta,not_ready',
    'provider_availability_reason' => 'preview_only,provider_not_ready',
    'capability_status' => 'coming_soon,internal_testing',
    'availability' => 'all',
]);

$batchSocketUrl = $client->getBatchWebSocketUrl('batch_123', 1500);
$videoSocketUrl = $client->getVideoWebSocketUrl('video_123', null, true);
$genericSocketUrl = $client->getAsyncJobWebSocketUrl('video', 'video_123');
$resourceSocketUrl = $client->asyncJobs()->websocketUrl('video', 'video_123');

echo $batchSocketUrl . PHP_EOL;
echo $videoSocketUrl . PHP_EOL;
echo $genericSocketUrl . PHP_EOL;
echo $resourceSocketUrl . PHP_EOL;