🚀 社区驱动的 PHP SDK,用于 DeepSeek AI 接口集成
- 无缝 API 集成: DeepSeek AI 功能的 PHP 优先接口
- 构建器模式: 直观的链接请求构建方法
- 企业级别: 符合 PSR-18 规范
- 模型灵活性: 支持多种 DeepSeek 模型(Coder、Chat 等)
- 流式传输: 内置对实时响应处理的支持
- 框架友好: 提供 Laravel 和 Symfony 包
通过 Composer 安装:
composer require deepseek-php/deepseek-php-client
要求:
- PHP 8.1+
只需两行代码即可开始:
use DeepSeek\DeepSeekClient;
$response = DeepSeekClient::build('your-api-key')
->query('Explain quantum computing in simple terms')
->run();
echo $response;
📌 默认配置:
- Model:
deepseek-chat
- Temperature: 0.8
use DeepSeek\DeepSeekClient;
use DeepSeek\Enums\Models;
$client = DeepSeekClient::build(apiKey:'your-api-key', baseUrl:'https://api.deepseek.com/v3', timeout:30, clientType:'guzzle');
$response = $client
->withModel(Models::CODER->value)
->withStream()
->withTemperature(1.2)
->run();
echo 'API Response:'.$response;
the package already built with symfony Http client
, if you need to use package with symfony
Http Client , it is easy to achieve that, just pass clientType:'symfony'
with build
function.
ex with symfony:
// with defaults baseUrl and timeout
$client = DeepSeekClient::build('your-api-key', clientType:'symfony')
// with customization
$client = DeepSeekClient::build(apiKey:'your-api-key', baseUrl:'https://api.deepseek.com/v3', timeout:30, clientType:'symfony');
$client->query('Explain quantum computing in simple terms')
->run();
use DeepSeek\DeepSeekClient;
$response = DeepSeekClient::build('your-api-key')
->getModelsList()
->run();
echo $response; // {"object":"list","data":[{"id":"deepseek-chat","object":"model","owned_by":"deepseek"},{"id":"deepseek-reasoner","object":"model","owned_by":"deepseek"}]}
从 v1.x 升级?请查看我们全面的 迁移指南 了解重大变更和升级说明。
详细的发布说明可在 CHANGELOG.md 查看。
./vendor/bin/pest
测试覆盖范围涵盖 v2.1。
报告漏洞: [email protected]
非常感谢为这个项目做出贡献的人! 🎉💖
Omar AlAlwi 🏆 Creator |
Ayman Alhattami ⭐ Contributor |
Mohammad Asaad ⭐ Contributor |
Opada Alzaiede ⭐ Contributor |
Hisham Bin Ateya ⭐ Contributor |
陈文锋 ⭐ Contributor |
想要贡献? 查看 contributing guidelines 并提交拉取请求! 🚀
基于 MIT License 开源协议。