PHP code example of aisdk / baseten

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

    

aisdk / baseten example snippets


use AiSdk\Baseten;
use AiSdk\Generate;

$result = Generate::text('Explain closures in PHP in one sentence.')
    ->model(Baseten::model('deepseek-ai/DeepSeek-V4.1-Flash'))
    ->run();

echo $result->text;