PHPackages                             papi-ai/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. papi-ai/openai

ActiveLibrary[API Development](/categories/api)

papi-ai/openai
==============

OpenAI provider for PapiAI

v0.9.1(2mo ago)05MITPHPPHP ^8.2CI passing

Since Mar 7Pushed 1mo agoCompare

[ Source](https://github.com/papi-ai/openai)[ Packagist](https://packagist.org/packages/papi-ai/openai)[ RSS](/packages/papi-ai-openai/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

PapiAI OpenAI Provider
======================

[](#papiai-openai-provider)

[![CI](https://github.com/papi-ai/openai/workflows/CI/badge.svg)](https://github.com/papi-ai/openai/actions?query=workflow%3ACI) [![Latest Version](https://camo.githubusercontent.com/7ae97d40a921c7d055acc9d4365f3903170a6214735583637f62fe19fb32df00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706170692d61692f6f70656e61692e737667)](https://packagist.org/packages/papi-ai/openai) [![Total Downloads](https://camo.githubusercontent.com/f97ef661492aad3ae0db74145bf13b7111db4331e7a9a5e2ac5f16cc87446337/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706170692d61692f6f70656e61692e737667)](https://packagist.org/packages/papi-ai/openai) [![PHP Version](https://camo.githubusercontent.com/b229a47bf036108a7fcf3131606673d66136703212d4ef2a7f56c864d699f1fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f706170692d61692f6f70656e61692e737667)](https://packagist.org/packages/papi-ai/openai) [![License](https://camo.githubusercontent.com/43cb83baa44d97f8f08ca0cdbec977437366601bb110bdfc8f087e4eba841ba4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f706170692d61692f6f70656e61692e737667)](https://packagist.org/packages/papi-ai/openai)

OpenAI provider for [PapiAI](https://github.com/papi-ai/papi-core) - A simple but powerful PHP library for building AI agents.

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

[](#installation)

```
composer require papi-ai/openai
```

Usage
-----

[](#usage)

```
use PapiAI\Core\Agent;
use PapiAI\OpenAI\OpenAIProvider;

$provider = new OpenAIProvider(
    apiKey: $_ENV['OPENAI_API_KEY'],
    defaultModel: OpenAIProvider::MODEL_GPT_4O,
);

$agent = new Agent(
    provider: $provider,
    model: 'gpt-4o',
    instructions: 'You are a helpful assistant.',
);

$response = $agent->run('Hello!');
echo $response->text;
```

Available Models
----------------

[](#available-models)

```
OpenAIProvider::MODEL_GPT_4O        // 'gpt-4o' (default, multimodal)
OpenAIProvider::MODEL_GPT_4O_MINI   // 'gpt-4o-mini' (fast, cost-effective)
OpenAIProvider::MODEL_GPT_4_TURBO   // 'gpt-4-turbo' (high quality)
OpenAIProvider::MODEL_O1_PREVIEW    // 'o1-preview' (reasoning)
OpenAIProvider::MODEL_O1_MINI       // 'o1-mini' (fast reasoning)
```

Features
--------

[](#features)

- Tool/function calling
- Vision/multimodal support
- Structured output (JSON mode)
- Streaming support

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance88

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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 ~0 days

Total

5

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/126c34b4dff8d42336ea07ac5297bcc3ec0a0e306fd964a7497f02240da4b142?d=identicon)[md](/maintainers/md)

---

Top Contributors

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

###  Code Quality

TestsPest

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/papi-ai-openai/health.svg)

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

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M49](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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