PHP code example of deepseek-php / deepseek-php-client

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

    

deepseek-php / deepseek-php-client example snippets


use DeepseekPhp\DeepseekClient;

$apiKey = 'your-api-key';

$response = DeepseekClient::build($apiKey)
    ->query('Hello Deepseek, how are you today?')
    ->run();

echo 'API Response:'.$response;

use DeepseekPhp\DeepseekClient;
use DeepseekPhp\Enums\Queries\QueryRoles;
use DeepseekPhp\Enums\Models;

$apiKey = 'your-api-key';

$response = DeepseekClient::build($apiKey, 'https://api.deepseek.com/v2', 500)
    ->query('System setup query', 'system')
    ->query('User input message', 'user')
    ->withModel(Models::CODER->value)
    ->run();

echo 'API Response:'.$response;
bash
composer