PHPackages                             zherooo/ai-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. zherooo/ai-client

ActiveLibrary[API Development](/categories/api)

zherooo/ai-client
=================

统一 AI 客户端 SDK，支持百度千帆、火山引擎、腾讯混元、OpenAI 等多个平台

v1.0.0(2mo ago)12↓100%MITPHPPHP &gt;=8.2

Since Mar 10Pushed 2mo agoCompare

[ Source](https://github.com/zherooo/ai-client)[ Packagist](https://packagist.org/packages/zherooo/ai-client)[ Docs](https://github.com/zherooo/ai-client)[ RSS](/packages/zherooo-ai-client/feed)WikiDiscussions master Synced 1mo ago

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

ai-client-aggregation
=====================

[](#ai-client-aggregation)

统一 AI 客户端 SDK，支持调用多个中国 AI 平台。

支持平台
----

[](#支持平台)

- 百度千帆
- 火山引擎
- 腾讯混元
- OpenAI 兼容接口

设计目标
----

[](#设计目标)

1 统一 AI 对话接口
2 支持 prompt 和 messages
3 支持普通返回和流式返回
4 支持模型抽象（deepseek / qwen 等）
5 支持平台 API 版本升级
6 使用工厂模式创建客户端

---

使用示例
====

[](#使用示例)

安装
--

[](#安装)

```
composer require zherooo/ai-client
```

快速开始
----

[](#快速开始)

```
use AiClient\Factory\AiFactory;
use AiClient\Request\ChatRequest;

// 创建客户端
$ai = AiFactory::make('volcengine', [
    'api_key' => 'your-api-key',
    'model' => 'deepseek-v3',  // 设置默认模型
]);

// 创建请求
$request = new ChatRequest();
$request->prompt = '写一首诗';

// 发送请求
$response = $ai->chat($request);
echo $response->content;
```

流式输出
----

[](#流式输出)

```
$ai->chatStream($request, function (array $data) {
    echo $data['choices'][0]['delta']['content'] ?? '';
});
```

请求中覆盖模型
-------

[](#请求中覆盖模型)

```
$request = new ChatRequest();
$request->prompt = '你好';
$request->model = 'qwen-max';  // 覆盖默认模型

$response = $ai->chat($request);
```

多轮对话
----

[](#多轮对话)

```
$request = new ChatRequest();
$request->messages = [
    ['role' => 'system', 'content' => '你是一个助手'],
    ['role' => 'user', 'content' => '你好'],
];

$response = $ai->chat($request);
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance88

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

61d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3afef9c7f98f498a8acd921fc05805a5390f5746410a3eac9945f3196de6dfd5?d=identicon)[zhaoheng](/maintainers/zhaoheng)

---

Top Contributors

[![zherooo](https://avatars.githubusercontent.com/u/12847916?v=4)](https://github.com/zherooo "zherooo (3 commits)")

---

Tags

aiopenaillmdeepseekvolcengineqwenqianfanhunyuan

### Embed Badge

![Health badge](/badges/zherooo-ai-client/health.svg)

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

###  Alternatives

[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.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[vectorifyai/vectorify-laravel

Vectorify package for Laravel. The fastest way to ask AI about your data.

206.1k](/packages/vectorifyai-vectorify-laravel)[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

213.2k1](/packages/qwen-php-qwen-php-client)

PHPackages © 2026

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