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

ActiveLibrary[API Development](/categories/api)

shevant/open-ai-client
======================

A PHP client for the Open AI API

1.0.0(2y ago)012MITPHPPHP ^8.1.0

Since Jun 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Shevants/openai-client)[ Packagist](https://packagist.org/packages/shevant/open-ai-client)[ RSS](/packages/shevant-open-ai-client/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

ChatGptClient
=============

[](#chatgptclient)

ChatGptClient is an API client for the OpenAI API, providing a convenient interface for interacting with various OpenAI resources.

Get Started
-----------

[](#get-started)

> **Requires [PHP 8.1+](https://php.net/releases/)**

First, install OpenAI via the [Composer](https://getcomposer.org/) package manager:

```
composer require shevant/open-ai-client
```

Ensure that the `php-http/discovery` composer plugin is allowed to run or install a client manually if your project does not already have a PSR-18 client integrated.

```
composer require guzzlehttp/guzzle
```

Running Tests
-------------

[](#running-tests)

To run all tests, use the following command:

```
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests

```

If PHPUnit is installed globally, you can run:

```
phpunit --bootstrap vendor/autoload.php tests

```

\##Usage

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

use OpenAiClient\OpenAiClient;
use GuzzleHttp\Client;

$transport = new Client();
$apiKey = 'your-api-key';
$client = new OpenAiClient($transport, $apiKey);

// Working with audio resources
$audio = $client->audio();
// Use $audio methods to interact with audio resources

// Working with chat resources
$chat = $client->chat();
// Use $chat methods to interact with chat resources

// Working with vector stores
$vectorStores = $client->vectorStores();
```

Resources
---------

[](#resources)

The client provides access to the following OpenAI resources:

- `Audio`: Interact with audio resources.

    ```
    public function createSpeech(array $params): array;
    public function createTranscription(array $params): array;
    public function createTranslation(array $params): array;
    ```
- `Chat`: Interact with chat resources.

    ```
    public function createChatCompletion(array $params): array;
    ```
- `Embeddings`: Interact with embeddings.

    ```
    public function createCreateEmbeddings(array $params): array;
    ```
- `FineTuning`: Interact with fine-tuning models.

    ```
      public function createFineTuningJob(array $params): array;
      public function listFineTuningJobs(array $params): array;
      public function listFineTuningEvents(string $fineTuningJobId, array $params): array;
      public function listFineTuningCheckpoints(string $fineTuningJobId, array $params): array;
      public function retrieveFineTuningJob(string $fineTuningJobId): array;
      public function cancelFineTuning(string $fineTuningJobId): array;
    ```
- `Batch`: Interact with batch operations.

    ```
      public function createBatch(array $params): array;
      public function retrieveBatch(string $batchId): array;
      public function cancelBatch(string $batchId): array;
      public function listBatch(array $params): array;
    ```
- `Files`: Interact with files.

    ```
      public function uploadFile(array $params): array;
      public function listFiles(string $batchId): array;
      public function retrieveFile(string $fileId): array;
      public function deleteFile(string $fileId): array;
      public function retrieveFileContent(string $fileId): array;
    ```
- `Images`: Interact with images.

    ```
      public function createImage(array $params): array;
      public function createImageEdit(array $params): array;
      public function createImageVariation(array $params): array;
    ```
- `Models`: Interact with models.

    ```
      public function listModels(): array;
      public function retrieveModel(string $model): array;
      public function deleteFineTunedModel(string $model): array;
    ```
- `Moderations`: Interact with moderations.

    ```
      public function createModeration(array $params): array;
    ```
- `Assistants`: Interact with assistants.

    ```
      public function createAssistant(array $params): array;
      public function listAssistants(array $params): array;
      public function retrieveAssistant(string $assistantId): array;
      public function modifyAssistant(string $assistantId, array $params): array;
      public function deleteAssistant(string $assistantId): array;
    ```
- `Threads`: Interact with threads.

    ```
      public function createThread(array $params): array;
      public function retrieveThread(string $threadId): array;
      public function modifyThread(string $threadId, array $params): array;
      public function modifyAssistant(string $assistantId, array $params): array;
      public function deleteThread(string $threadId): array;
    ```
- `Messages`: Interact with messages.

    ```
      public function createMessage(string $threadId, array $params): array;
      public function listMessages(string $threadId, array $params): array;
      public function retrieveMessage(string $threadId, string $messageId): array;
      public function modifyMessage(string $threadId, string $messageId, array $params): array;
      public function deleteMessage(string $threadId, string $messageId): array;
    ```
- `Runs`: Interact with runs.

    ```
      public function createRun(string $threadId, array $params): array;
      public function createThreadAndRun(array $params): array;
      public function listRuns(string $threadId, array $params): array;
      public function retrieveRun(string $threadId, string $runId): array;
      public function modifyRun(string $threadId, string $runId, array $params): array;
      public function submitToolOutputsToRun(string $threadId, string $runId, array $params): array;
      public function cancelRun(string $threadId, string $runId): array;
    ```
- `RunSteps`: Interact with run steps.

    ```
      public function listRunSteps(string $threadId, string $runId, array $params): array;
      public function retrieveRunStep(string $threadId, string $runId, string $stepId): array;
    ```
- `VectorStores`: Interact with vector stores.

    ```
      public function createVectorStore(array $params): array;
      public function listVectorStore(array $params): array;
      public function retrieveVectorStore(string $vectorStoreId): array;
      public function modifyVectorStore(string $vectorStoreId, array $params): array;
      public function deleteVectorStore(string $vectorStoreId): array;
    ```
- `VectorStoreFiles`: Interact with vector store files.

    ```
      public function createVectorStoreFile(string $vectorStoreId, array $params): array;
      public function listVectorStoreFiles(string $vectorStoreId, array $params): array;
      public function retrieveVectorStoreFile(string $vectorStoreId, string $fileId): array;
      public function deleteVectorStoreFile(string $vectorStoreId, string $fileId): array;
    ```
- `VectorStoreFileBatches`: Interact with vector store file batches.

    ```
      public function createVectorStoreFileBatch(string $vectorStoreId, array $params): array;
      public function retrieveVectorStoreFileBatch(string $vectorStoreId, string $batchId): array;
      public function cancelVectorStoreFileBatch(string $vectorStoreId, string $batchId): array;
      public function listVectorStoreFilesBatch(string $vectorStoreId, string $batchId): array;
    ```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

735d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46407093?v=4)[Shevant](/maintainers/Shevant)[@shevant](https://github.com/shevant)

---

Top Contributors

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

---

Tags

phpapiclient

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/shevant-open-ai-client/health.svg)](https://phpackages.com/packages/shevant-open-ai-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)[deeplcom/deepl-php

Official DeepL API Client Library

2607.3M113](/packages/deeplcom-deepl-php)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9067.8k](/packages/n1ebieski-ksef-php-client)[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.

46688.8k5](/packages/deepseek-php-deepseek-php-client)

PHPackages © 2026

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