openai-php logo

openai-php

Free

2.3k

FreeFree tier
Inputs: textOutputs: text, image
Type
Open Source

About openai-php

OpenAI PHP SDK is a community-developed PHP client library for integrating OpenAI's APIs, including GPT-3, GPT-3.5, GPT-4 (via ChatGPT API), and DALL-E image generation. It supports streaming responses similar to ChatGPT and is designed to work with any PHP framework such as Laravel, Symfony, Yii, or Cake PHP. The library is open-source and hosted on GitHub, claiming to be the most downloaded, forked, and contributed PHP SDK for OpenAI. It requires PHP 7.4 or higher and is maintained by the community with support available through a Discord server or direct email.

Key Features

Provides a PHP SDK for OpenAI APIs including GPT-3, GPT-3.5, GPT-4, and DALL-E
Supports streaming responses similar to ChatGPT
Compatible with PHP 7.4+ and major PHP frameworks (Laravel, Symfony, Yii, Cake PHP)
Open-source with a large community (2.4k stars, 296 forks)
Includes support for the ChatGPT API
Offers a composer package for easy installation

Pros & Cons

Pros
  • Free and open-source with a permissive license (MIT)
  • Large community support and frequent updates
  • Supports multiple OpenAI models (GPT-3, GPT-3.5, GPT-4, DALL-E)
  • Compatible with popular PHP frameworks
  • Includes streaming support for real-time responses
Cons
  • Requires an OpenAI API key and associated usage costs
  • Dependent on OpenAI's API availability and rate limits
  • Documentation may be limited to GitHub README and community resources
  • PHP 7.4+ requirement may not suit older projects

Best For

Building AI-powered chatbots in PHP applicationsGenerating text completions and summaries using GPT modelsCreating images from text descriptions via DALL-EIntegrating conversational AI into Laravel or Symfony projectsDeveloping streaming chat interfaces similar to ChatGPT

FAQ

Is this an official OpenAI SDK?
No, this is a community-developed SDK, not an official OpenAI product.
Does it support the ChatGPT API?
Based on the repository description, it supports the ChatGPT API and streaming responses.
What PHP version is required?
The SDK requires PHP 7.4 or higher, according to the repository.
Is there any cost to use this SDK?
The SDK itself is free and open-source, but you will need an OpenAI API key which incurs usage charges based on OpenAI's pricing.
Can I use this with Laravel?
Yes, the SDK is designed to work with Laravel and other PHP frameworks.
How do I get support?
Support is available through the community Discord server or by contacting the maintainer via email, as mentioned in the repository.