PHPackages                             php-client/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. [API Development](/categories/api)
4. /
5. php-client/openai

ActiveLibrary[API Development](/categories/api)

php-client/openai
=================

PHP Client for OpenAI API

v0.1.1(1y ago)429MITPHPPHP ^8.3

Since Feb 13Pushed 1y agoCompare

[ Source](https://github.com/php-client/openai)[ Packagist](https://packagist.org/packages/php-client/openai)[ RSS](/packages/php-client-openai/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

PHP client for OpenAI API.
==========================

[](#php-client-for-openai-api)

This is a PHP client for the OpenAI API.

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

[](#installation)

Install the package via composer:

```
composer require php-client/openai
```

Usage
-----

[](#usage)

```
use PhpClient\OpenAI\OpenAI;

$openai = new OpenAI(
    baseUrl: 'https://api.openai.com',
    token: 'YOUR_API_TOKEN',
);

$response = $openai->api->chat()->createChatCompletion(
    model: 'gpt-4o',
    messages: [
        ['role' => 'user', 'content' => 'Hello'],
    ],
);

echo $response->json(key: 'choices.0.message.content');

// or

foreach ($response->json(key: 'choices') as $choice) {
    echo $choice['message']['content'];
}
```

List of available API methods
-----------------------------

[](#list-of-available-api-methods)

- Audio
    - Create speech|transcription|translation
- Chat
    - Create chat completion
- Embeddings
    - Create embeddings
- Fine-tuning
    - Create|Retrieve|Cancel fine-tuning job
    - List fine-tuning jobs|events|checkpoints
- Batch
    - Create|Retrieve|Cancel|List batch
- Files
    - List files
    - Upload|Retrieve|Delete file
    - Retrieve file content
- Uploads
    - Create|Complete|Cancel upload
    - Add upload part
- Images
    - Create image
    - Create image edit|variation
- Models
    - List models
    - Retrieve model
    - Delete fine-tuned model
- Moderations
    - Create moderation
- LegacyCompletions
    - Create completion

Not implemented API methods (in development)
--------------------------------------------

[](#not-implemented-api-methods-in-development)

- Assistants
- Administration
- Realtime
- Legacy

License
-------

[](#license)

This package is released under the [MIT License](LICENSE.md).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance45

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Every ~70 days

Total

2

Last Release

424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/31df2ea335c3dda0ced87001849611067f9107484dd487ddfc5971311ccd6222?d=identicon)[sentosango](/maintainers/sentosango)

---

Top Contributors

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

---

Tags

apiclientgptopenaiphpsaloonsdkapiclientopenaisaloongpt

### Embed Badge

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

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

###  Alternatives

[openai-php/client

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

5.8k26.1M294](/packages/openai-php-client)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

806.6M187](/packages/saloonphp-laravel-plugin)[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.

46784.5k5](/packages/deepseek-php-deepseek-php-client)[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.2k1](/packages/qwen-php-qwen-php-client)

PHPackages © 2026

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