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

ActiveLibrary[API Development](/categories/api)

blinq/openai
============

PHP library wrapper for the OpenAI API.

v1.0.4(2y ago)714.6k↓36.2%11MITPHPPHP &gt;=8.1

Since Jun 19Pushed 2y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (6)Used By (1)

PHP OpenAI API
==============

[](#php-openai-api)

(Written by ChatGPT)

This is a library for interacting with Language Learning Models (LLMs), built with a focus on AI-driven chat functionalities. The library currently supports OpenAI's GPT-3.5-turbo, but it can be extended to support other LLMs as well.

Features
--------

[](#features)

- **Cross-API Compatibility**: The library is designed to work with different language learning models, including OpenAI's GPT-3.5-turbo.
- **Ease of Use**: With simple configuration and intuitive API, this library enables developers to easily interact with complex language learning models.
- **Streaming Support**: The library offers streaming capabilities that allow real-time interactions with language learning models.
- **Chat History**: The library maintains a history of the chat session which can be retrieved and analyzed anytime.
- You can add support for other AI providers by extending the `ApiClient` class and implementing the required methods.
- **Error Handling**: The library provides robust error handling to deal with potential issues during interactions with language learning models.
- **Documentation**: Comprehensive documentation is available to guide developers in using the library.
- **Community Support**: Issues and feature requests can be raised in the GitHub repository, and the active community is open to discussions and improvements.
- **License**: The library is open source and is licensed under the MIT License.
- **Support for Future AI Models**: The architecture of the library is designed to support any future language learning models seamlessly.
- It is clean, well-structured, and includes comments for clarity.

Getting Started
---------------

[](#getting-started)

Firstly, you need to install the library in your PHP project.

```
composer require blinq/openai

```

Usage
-----

[](#usage)

### Chat with OpenAI's GPT-3.5-turbo

[](#chat-with-openais-gpt-35-turbo)

You need to initialize a client object using `ApiClient` configuration. The following example demonstrates a chat session with OpenAI's GPT-3.5-turbo.

```
