PHP code example of jpcaparas / deepseek-php-client
1. Go to this page and download the library: Download jpcaparas/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/ */
jpcaparas / deepseek-php-client example snippets
use DeepSeek\DeepSeekClient;
$client = new DeepSeekClient('your-api-key');
$response = $client
->setMessage('user', 'What is 2+2?')
->send();
print_r($response);
// Initialize client
$client = new DeepSeekClient('your-api-key');
// Add a message to the conversation
$client->setMessage('system', 'You are a helpful assistant');
$client->setMessage('user', 'Hello'); // Returns self for chaining
// Clear conversation history
$client->clearMessages(); // Returns self for chaining
// Send conversation to API (returns array)
$response = $client->send();