client  by openai-php

PHP API client for OpenAI

created 2 years ago
5,465 stars

Top 9.4% on sourcepulse

GitHubView on GitHub
Project Summary

This PHP library provides a robust client for interacting with the OpenAI API, targeting PHP developers who want to integrate advanced AI capabilities into their applications. It offers comprehensive coverage of OpenAI's models and features, including chat completions, audio processing, embeddings, and the Assistants API, simplifying complex API interactions.

How It Works

The client leverages PSR-18 for HTTP client compatibility, allowing flexibility in choosing underlying HTTP libraries like Guzzle. It abstracts the complexities of API endpoints, request formatting, and response parsing into a fluent, object-oriented interface. This design promotes code readability and maintainability, enabling developers to focus on leveraging AI features rather than managing low-level API details.

Quick Start & Requirements

  • Install: composer require openai-php/client
  • Prerequisites: PHP 8.1+
  • Dependencies: A PSR-18 compatible HTTP client (e.g., guzzlehttp/guzzle).
  • Setup: Install via Composer.
  • Documentation: https://github.com/openai-php/client

Highlighted Details

  • Supports all major OpenAI API endpoints, including Assistants API (v2).
  • Provides streaming capabilities for chat and audio completions.
  • Includes comprehensive testing utilities with request assertion methods.
  • Offers specific configurations for Azure OpenAI Service integration.

Maintenance & Community

The project is community-maintained, with significant contributions from Nuno Maduro. Support is encouraged via GitHub Sponsors.

Licensing & Compatibility

  • License: MIT License
  • Compatibility: Permissive MIT license allows for commercial use and integration into closed-source projects.

Limitations & Caveats

The README notes that the Edits and FineTunes APIs are deprecated by OpenAI and will cease functioning. Users should migrate to newer APIs like Chat Completions and the new FineTuning API.

Health Check
Last commit

4 days ago

Responsiveness

Inactive

Pull Requests (30d)
11
Issues (30d)
4
Star History
178 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.