PHPackages                             deepseek-php/deepseek-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. deepseek-php/deepseek-php-client

ActiveLibrary[API Development](/categories/api)

deepseek-php/deepseek-php-client
================================

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

2.1.0(1mo ago)46688.8k↓67.7%53[1 issues](https://github.com/deepseek-php/deepseek-php-client/issues)[1 PRs](https://github.com/deepseek-php/deepseek-php-client/pulls)5MITPHPPHP ^8.2.0CI passing

Since Jan 2Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/deepseek-php/deepseek-php-client)[ Packagist](https://packagist.org/packages/deepseek-php/deepseek-php-client)[ Docs](https://github.com/deepseek-php/deepseek-php-client)[ RSS](/packages/deepseek-php-deepseek-php-client/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (38)Versions (34)Used By (5)

DeepSeek PHP Client
===================

[](#deepseek-php-client)

⚡️ A community-driven, open-source PHP client for DeepSeek AI, officially listed in the DeepSeek API documentation and built for expressive, production-ready AI integrations.

 [ ![Latest Version](https://camo.githubusercontent.com/0dfa915be2a881af7a78f96adf14899422b9665b3956d15f98254d334963e81f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646565707365656b2d7068702f646565707365656b2d7068702d636c69656e74) ](https://packagist.org/packages/deepseek-php/deepseek-php-client) [ ![Total Downloads](https://camo.githubusercontent.com/152df40174b44064b0d076032bf7f15b0183e45118db74cd2d7a6626c58fee49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646565707365656b2d7068702f646565707365656b2d7068702d636c69656e74) ](https://packagist.org/packages/deepseek-php/deepseek-php-client) [ ![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565) ](https://php.net) [ ![License](https://camo.githubusercontent.com/88e1dabf4d223df0950e0985948e231325fefca9fa7fe9e446cf8b1c5e9d9e47/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e) ](LICENSE.md) [ ![GitHub Stars](https://camo.githubusercontent.com/d12736f09baddf4f1cc0a2c7c0eb0f561267bb8eb1b0fd0079ace559cd625add/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f646565707365656b2d7068702f646565707365656b2d7068702d636c69656e743f7374796c653d736f6369616c) ](https://github.com/deepseek-php/deepseek-php-client/stargazers)

[AR](README-AR.md) | [CN](README-CN.md)

Table of Contents
-----------------

[](#table-of-contents)

- [✨ Features](#-features)
- [📦 Installation](#-installation)
- [🚀 Quick Start](#-quick-start)
    - [Basic Usage](#basic-usage)
    - [Advanced Configuration](#advanced-configuration)
    - [important warning with json mode](#-deepseek-json-mode-requirement)
    - [Use with Symfony HttpClient](#use-with-symfony-httpclient)
    - [Get Models List](#get-models-list)
    - [Function Calling](#function-calling)
    - [Framework Integration](#-framework-integration)
- [🆕 Migration Guide](#-migration-guide)
- [📝 Changelog](#-changelog)
- [🧪 Testing](#-testing)
- [🔒 Security](#-security)
- [📄 License](#-license)

---

✨ Features
----------

[](#-features)

- **Seamless API Integration**: PHP-first interface for DeepSeek's AI capabilities.
- **Fluent Builder Pattern**: Chainable methods for intuitive request building.
- **Enterprise Ready**: PSR-18 compliant HTTP client integration.
- **Latest DeepSeek V4 Models**: First-class support for `deepseek-v4-pro` and `deepseek-v4-flash` with 1M-token context windows and thinking / non-thinking modes.
- **Streaming Ready**: Built-in support for real-time response handling.
- **Many Http Clients**: easy to use `Guzzle http client` (default) , or `symfony http client`.
- **Framework Friendly**: Laravel &amp; Symfony packages available.

> **Supported Models**
>
> - `Models::V4_PRO` — flagship 1.6T/49B-active model, max 384K output tokens.
> - `Models::V4_FLASH` — fast, economical 284B/13B-active model, max 384K output tokens.
>
> Legacy `Models::CHAT`, `Models::CODER`, `Models::R1`, and `Models::R1Zero` are deprecated and will be removed in v3.0.0. The `deepseek-chat` and `deepseek-reasoner` aliases retire from the DeepSeek API on **2026-07-24**.

---

📦 Installation
--------------

[](#-installation)

Require the package via Composer:

```
composer require deepseek-php/deepseek-php-client
```

**Requirements**:

- PHP 8.1+

---

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage

[](#basic-usage)

Get started with just two lines of code:

```
use DeepSeek\DeepSeekClient;

$response = DeepSeekClient::build('your-api-key')
    ->query('Explain quantum computing in simple terms')
    ->run();

echo $response;
```

📌 Defaults used:

- Model: API default (no `model` field sent unless you call `withModel()`)
- Temperature: 1.3 (`TemperatureValues::GENERAL_CONVERSATION`)
- Max tokens: 4096
- Response format: `text`

### Advanced Configuration

[](#advanced-configuration)

```
use DeepSeek\DeepSeekClient;
use DeepSeek\Enums\Models;

$client = DeepSeekClient::build(apiKey:'your-api-key', baseUrl:'https://api.deepseek.com', timeout:30, clientType:'guzzle');

$response = $client
    ->withModel(Models::V4_PRO->value)
    ->withStream()
    ->setTemperature(1.2)
    ->setMaxTokens(8192)
    ->setResponseFormat('text') // or "json_object"  with careful .
    ->query('Explain quantum computing in simple terms')
    ->run();

echo 'API Response:'.$response;
```

⚠️ DeepSeek JSON Mode Requirement
---------------------------------

[](#️-deepseek-json-mode-requirement)

When using:

```
->setResponseFormat('json_object')
```

Your prompt **must contain the word `"json"`** in some form. Otherwise, the API will reject the request with the following error:

> `"Prompt must contain the word 'json' in some form to use 'response_format' of type 'json_object'"`

---

### 🚫 Incorrect Usage

[](#-incorrect-usage)

```
->setResponseFormat('json_object')
->query('Explain quantum computing in simple terms')
```

### ✅ Correct Usage

[](#-correct-usage)

```
->setResponseFormat('json_object')
->query('Respond in valid JSON format. Explain quantum computing in simple terms.')
```

> ✅ **Tip**: For best results, also provide a JSON example or explicitly say: *"Respond only in valid JSON."*

---

### Use with Symfony HttpClient

[](#use-with-symfony-httpclient)

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', timeout:30, clientType:'symfony');

$client->query('Explain quantum computing in simple terms')
       ->run();
```

### Get Models List

[](#get-models-list)

```
use DeepSeek\DeepSeekClient;

$response = DeepSeekClient::build('your-api-key')
    ->getModelsList()
    ->run();

echo $response;
// {
//   "object": "list",
//   "data": [
//     {"id": "deepseek-v4-pro",   "object": "model", "owned_by": "deepseek"},
//     {"id": "deepseek-v4-flash", "object": "model", "owned_by": "deepseek"},
//     {"id": "deepseek-chat",     "object": "model", "owned_by": "deepseek"},     // deprecated, retires 2026-07-24
//     {"id": "deepseek-reasoner", "object": "model", "owned_by": "deepseek"}      // deprecated, retires 2026-07-24
//   ]
// }
```

### Function Calling

[](#function-calling)

Function Calling allows the model to call external tools to enhance its capabilities.[\[1\]](https://api-docs.deepseek.com/guides/function_calling)

You Can check the documentation for function calling in [FUNCTION-CALLING.md](docs/FUNCTION-CALLING.md)

### 🛠 Framework Integration

[](#-framework-integration)

### [Laravel Deepseek Package](https://github.com/deepseek-php/deepseek-laravel)

[](#laravel-deepseek-package)

---

🚧 Migration Guide
-----------------

[](#-migration-guide)

Upgrading from v1.x? Check our comprehensive [Migration Guide](MIGRATION.md) for breaking changes and upgrade instructions.

---

📝 Changelog
-----------

[](#-changelog)

Detailed release notes available in [CHANGELOG.md](CHANGELOG.md)

---

🧪 Testing
---------

[](#-testing)

```
./vendor/bin/pest
```

Test coverage coming in v2.1.

---

🐘✨ **DeepSeek PHP Community** ✨🐘
================================

[](#-deepseek-php-community-)

Click the button bellow or [join here](https://t.me/deepseek_php_community) to be part of our growing community!

[![Join Telegram](https://camo.githubusercontent.com/8ee56c562bc6b3d5388bf271630b4e222e6d23d3fce48f4dfb22b19f9ce12229/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4a6f696e2d54656c656772616d2d626c75653f7374796c653d666f722d7468652d6261646765266c6f676f3d74656c656772616d)](https://t.me/deepseek_php_community)

### **Channel Structure** 🏗️

[](#channel-structure-️)

- 🗨️ **General** - Daily chatter
- 💡 **Ideas &amp; Suggestions** - Shape the community's future
- 📢 **Announcements &amp; News** - Official updates &amp; news
- 🚀 **Releases &amp; Updates** - Version tracking &amp; migration support
- 🐞 **Issues &amp; Bug Reports** - Collective problem-solving
- 🤝 **Pull Requests** - Code collaboration &amp; reviews

---

🔒 Security
----------

[](#-security)

**Report Vulnerabilities**: to

---

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT License](LICENSE.md).

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 75.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~113 days

Total

11

Last Release

40d ago

Major Versions

1.0.2 → 2.0.02025-01-31

PHP version history (2 changes)1.0.0.0PHP ^8.1.0

2.1.0PHP ^8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/46733da79a34ff686b036a09af1dcc6d21054aee25a5e029500dc87d3c69ba89?d=identicon)[WatheqAlshowaiter](/maintainers/WatheqAlshowaiter)

![](https://www.gravatar.com/avatar/92882431481b621f6509ff259dd600e327c27fc77adcba4fcc7177659059c9a8?d=identicon)[omaralalwi](/maintainers/omaralalwi)

![](https://www.gravatar.com/avatar/c1f16d496594fbcc1f1bb95c457f00b7790fb333a2f618662f3731d11649cd5a?d=identicon)[deepseek-php](/maintainers/deepseek-php)

---

Top Contributors

[![omaralalwi](https://avatars.githubusercontent.com/u/25439498?v=4)](https://github.com/omaralalwi "omaralalwi (106 commits)")[![moassaad](https://avatars.githubusercontent.com/u/155223476?v=4)](https://github.com/moassaad "moassaad (19 commits)")[![hishamco](https://avatars.githubusercontent.com/u/3237266?v=4)](https://github.com/hishamco "hishamco (8 commits)")[![aymanalhattami](https://avatars.githubusercontent.com/u/34315778?v=4)](https://github.com/aymanalhattami "aymanalhattami (4 commits)")[![kghamilton89](https://avatars.githubusercontent.com/u/29099829?v=4)](https://github.com/kghamilton89 "kghamilton89 (1 commits)")[![OpadaAlzaiede](https://avatars.githubusercontent.com/u/48367429?v=4)](https://github.com/OpadaAlzaiede "OpadaAlzaiede (1 commits)")[![VinchanGit](https://avatars.githubusercontent.com/u/38177046?v=4)](https://github.com/VinchanGit "VinchanGit (1 commits)")

---

Tags

aiapi-clientdeepseekdeepseek-apideepseek-chatdeepseek-coderdeepseek-integrationdeepseek-learningdeepseek-php-clientdeepseek-php-librarydeepseek-r1deepseek-sdkdeepseek-symfonydeepseek-v3deepseek-v4-flashnlpphp-deepseekphp-openai-alternativetext-generationphpapiclientsymfonysdkaiopenaiphp-sdknlpApi Wrappermachine learningllmnatural language processingai apiapi integrationAI SDKdeepseekdeveloper-toolstext-generationphp-api-clientrest-clientgenerative-aideepseek-apideepseek-aiai-client-libraryphp-ai-integrationopenai-alternativesymfony-deepseekdeepseek-symfonysymfony-http-clientsymfony-client

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/deepseek-php-deepseek-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/deepseek-php-deepseek-php-client/health.svg)](https://phpackages.com/packages/deepseek-php-deepseek-php-client)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k28.0M318](/packages/openai-php-client)[mozex/anthropic-php

PHP client for the Anthropic API: messages, streaming, tool use, thinking, web search, code execution, batches, and more.

49552.5k18](/packages/mozex-anthropic-php)[qwen-php/qwen-php-client

robust and community-driven PHP SDK library for seamless integration with the qwen AI API, offering efficient access to advanced AI and data processing capabilities

203.3k1](/packages/qwen-php-qwen-php-client)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)[deeplcom/deepl-php

Official DeepL API Client Library

2607.3M113](/packages/deeplcom-deepl-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
