openai-php/client
⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
What it solves
PHP developers need a clean, reliable way to call the OpenAI API. This package removes the boilerplate of raw HTTP requests and JSON handling, giving you a typed, object-oriented client that mirrors OpenAI's endpoints.
How it works
Install it with Composer, then create a client using your API key. The client exposes resource groups like models, responses, conversations, agents, and more. Each resource offers methods such as create, retrieve, list, and delete. You pass parameters as PHP arrays and receive typed objects with property access. Streaming is supported for real‑time responses. The client is configurable: you can set a custom base URI, HTTP client, headers, query parameters, and even switch to Azure OpenAI.
Who it’s for
PHP developers building applications that use OpenAI’s capabilities—text generation, images, embeddings, fine‑tuning, and beyond. Requires PHP 8.2 or newer.
Highlights
- Broad API coverage: models, responses, conversations, containers, skills, agents, vaults, chat, audio, embeddings, files, fine‑tuning, images, vector stores, and more.
- Streaming support via server‑sent events.
- Flexible configuration: custom HTTP client, headers, query parameters, base URI, and Azure support.
- Legacy endpoints (Completions, Assistants, Threads, etc.) remain available for backward compatibility.
Related
- Project
- Project
- Project
- Project
- Project