Skip to main content

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.
CapabilitySupport
Text generationNative
StreamingNative
Tool callingNative
Structured outputNative (json_schema)
ReasoningNative (reasoning_effort)
Image generationNative
Text inputNative
Image inputNative
Audio inputNative
File inputNative

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 / PatternStatusModalitiesKey Capabilities
openai/gpt-oss-20bStableTextText generation, Streaming, Tool calling, Structured output, Text input
gpt-4oStableTextText generation, Streaming, Tool calling, Structured output, Text input, Image input
gpt-4o*StableTextText generation, Streaming, Tool calling, Structured output, Text input, Image input
gpt-4.1*StableTextText generation, Streaming, Tool calling, Structured output, Text input, Image input, File input
gpt-*-audio*StableTextText generation, Streaming, Tool calling, Structured output, Text input, Audio input
o*StableTextText generation, Streaming, Tool calling, Structured output, Reasoning, Text input, Image input
gpt-5*StableTextText generation, Streaming, Tool calling, Structured output, Reasoning, Text input, Image input, File input
gpt-image-1StableImageImage generation
dall-e-3StableImageImage generation
dall-e-2StableImageImage generation
aisdk/openai requires aisdk/core ^0.2 and PHP 8.3+. Make sure both constraints are satisfied before installing.

Build docs developers (and LLMs) love