PHPackages                             jpcaparas/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. jpcaparas/deepseek-php-client

ActiveLibrary[API Development](/categories/api)

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

PHP client for DeepSeek AI API

v0.1.2(1y ago)3181MITPHPPHP ^8.1

Since Jan 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jpcaparas/deepseek-php-client)[ Packagist](https://packagist.org/packages/jpcaparas/deepseek-php-client)[ RSS](/packages/jpcaparas-deepseek-php-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

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

[](#deepseek-php-api-client)

A lightweight PHP wrapper for the DeepSeek Chat API.

[![Tests](https://github.com/jpcaparas/deepseek-php-client/actions/workflows/tests.yml/badge.svg)](https://github.com/jpcaparas/deepseek-php-client/actions/workflows/tests.yml/badge.svg)

Requirements
------------

[](#requirements)

- PHP 8.1+
- Guzzle HTTP Client
- Valid DeepSeek API key

Installation
------------

[](#installation)

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

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

*(You can also use PsySH for interactive testing)*

```
require 'vendor/autoload.php';

use DeepSeek\DeepSeekClient;

$client = new DeepSeekClient('your-api-key');

$response = $client
    ->setMessage('user', 'What is 2+2?')
    ->send();

print_r($response);
```

### Available Methods

[](#available-methods)

```
// 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();
```

### Response Format

[](#response-format)

A successful response will have this structure:

Abridged:

```
[
    'choices' => [
        ['message' => ['content' => 'Response text here']]
    ]
]
```

Full:

```
[
    "id" => "d7b42b8b-5007-42c6-b607-7b3b7b7b7b7b",
    "object" => "chat.completion",
    "created" => 1735810490,
    "model" => "deepseek-chat",
    "choices" => [
      [
        "index" => 0,
        "message" => [
          "role" => "assistant",
          "content" => "Hello! How can I assist you today? 😊",
        ],
        "logprobs" => null,
        "finish_reason" => "stop",
      ],
    ],
    "usage" => [
      "prompt_tokens" => 9,
      "completion_tokens" => 11,
      "total_tokens" => 20,
      "prompt_cache_hit_tokens" => 0,
      "prompt_cache_miss_tokens" => 9,
    ],
    "system_fingerprint" => "d7b42b8b-5007-42c6-b607-7b3b7b7b7b7b",
  ]
```

### Error Handling

[](#error-handling)

```
try {
    $response = $client
        ->setMessage('user', 'Hello')
        ->send();
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

The client will return the error response from the API if available, otherwise throw an exception.

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance41

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

498d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2406808?v=4)[JP Caparas](/maintainers/jpcaparas)[@jpcaparas](https://github.com/jpcaparas)

---

Top Contributors

[![jpcaparas](https://avatars.githubusercontent.com/u/2406808?v=4)](https://github.com/jpcaparas "jpcaparas (9 commits)")

---

Tags

aiapi-clientdeepseekphprest

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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