PHPackages                             webman/openai - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. webman/openai

ActiveLibrary[HTTP &amp; Networking](/categories/http)

webman/openai
=============

OpenAI client for webman or workerman

v3.1.0(1mo ago)714.4k—3.2%9[4 issues](https://github.com/webman-php/openai/issues)MITPHPPHP &gt;=8.1.0

Since Jan 30Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/webman-php/openai)[ Packagist](https://packagist.org/packages/webman/openai)[ RSS](/packages/webman-openai/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (8)Versions (20)Used By (0)

webman/openai
=============

[](#webmanopenai)

**English** | [简体中文](README.zh-CN.md)

Non-blocking OpenAI client for PHP with coroutine support and a built-in connection pool, designed for [Workerman](https://github.com/walkor/workerman) / [webman](https://github.com/walkor/webman).

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

[](#installation)

```
composer require webman/openai
```

Requires **PHP 8.1+** and a **Workerman 5.1+** runtime.

> **Enable coroutines in webman**
> Set `webman.eventLoop` in `config/process.php` to `Workerman\Events\Fiber::class`.
> If the `swoole` or `swow` extension is installed, you may use `Workerman\Events\Swoole::class` or `Workerman\Events\Swow::class` instead.

---

Quick overview (Workerman)
--------------------------

[](#quick-overview-workerman)

### Non-streaming

[](#non-streaming)

```
