johadtech / deepseek-v3
A Laravel package for integrating DeepSeek V3 API.
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/cache: ^10.0
- illuminate/http: ^10.0
- illuminate/support: ^10.0
Requires (Dev)
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-06-09 15:42:14 UTC
README
A robust Laravel package for integrating the DeepSeek V3 API.
Installation
Step 1: Install via Composer
Run the following command in your terminal:
composer require johadtech/deepseek-v3
Step 2: Publish the Configuration File
Once installed, publish the package configuration file using:
php artisan vendor:publish --provider="Johadtech\DeepSeekV3\Providers\DeepSeekServiceProvider" --tag="deepseek-config"
Step 3: Set Up Your API Key
Open your .env
file and add the following entry:
DEEPSEEK_API_KEY=your_api_key_here
Replace your_api_key_here
with your actual DeepSeek API key.
Usage
Basic Chat Completion
To send a simple chat message to DeepSeek:
use Johadtech\DeepSeekV3\Facades\DeepSeek; $response = DeepSeek::chat([ ['role' => 'user', 'content' => 'Hello'] ]); echo $response['content'];
Advanced Chat Completion with Parameters
You can also specify additional parameters for more control:
$response = DeepSeek::chat( messages: [ ['role' => 'user', 'content' => 'Explain quantum computing'] ], params: [ 'model' => 'deepseek-reasoner', 'temperature' => 0.7, 'max_tokens' => 1000 ] );
Handling Errors
Ensure you catch exceptions when making API calls:
try { $response = DeepSeek::chat([['role' => 'user', 'content' => 'Tell me a joke']]); echo $response['content']; } catch (Exception $e) { echo "Error: " . $e->getMessage(); }
Testing
To run tests, use:
composer test
Ensure you have PHPUnit installed in your development environment.
Documentation
For full documentation, visit DeepSeek API Docs.
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
feature-name
). - Commit your changes.
- Submit a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for details.