Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/openai/llms.txt
Use this file to discover all available pages before exploring further.
aisdk/openai is the official OpenAI provider for the PHP AI SDK. It plugs directly into aisdk/core and gives your PHP application a clean, strongly-typed interface to OpenAI’s full model surface — from everyday chat completions with gpt-4o to reasoning models in the o* family, audio-capable models, and image generation via gpt-image-1 and DALL·E. Rather than handling raw HTTP yourself, you call the high-level Generate facade from aisdk/core, point it at an OpenAI::model() or OpenAI::image() handle, and the provider takes care of authentication, request serialisation, streaming, and response normalisation.
Installation
Install the package with Composer and configure your OpenAI API key.
Quickstart
Generate text, stream tokens, and create images in under five minutes.
Configuration
Customise the base URL, organisation header, and per-request options.
Guides
Deep-dives into tool calling, structured output, reasoning, and more.
Supported Capabilities
Every capability listed below is handled natively by the provider — no additional adapters or workarounds are required.| Capability | Support |
|---|---|
| Text generation | Native |
| Streaming | Native |
| Tool calling | Native |
| Structured output | Native (json_schema) |
| Reasoning | Native (reasoning_effort) |
| Image generation | Native |
| Text input | Native |
| Image input | Native |
| Audio input | Native |
| File input | Native |
Supported Models
The table below reflects the model registry shipped with the package (resources/models.json). Wildcard patterns (e.g. gpt-4o*) match all versioned aliases of a base model family. You can also register new model IDs at runtime without waiting for a package release — see the Custom Model Registration guide.
| Model ID / Pattern | Status | Modalities | Key Capabilities |
|---|---|---|---|
openai/gpt-oss-20b | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Text input |
gpt-4o | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Text input, Image input |
gpt-4o* | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Text input, Image input |
gpt-4.1* | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Text input, Image input, File input |
gpt-*-audio* | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Text input, Audio input |
o* | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Reasoning, Text input, Image input |
gpt-5* | Stable | Text | Text generation, Streaming, Tool calling, Structured output, Reasoning, Text input, Image input, File input |
gpt-image-1 | Stable | Image | Image generation |
dall-e-3 | Stable | Image | Image generation |
dall-e-2 | Stable | Image | Image generation |
aisdk/openai requires aisdk/core ^0.2 and PHP 8.3+. Make sure both constraints are satisfied before installing.