Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/phpaisdk/openrouter/llms.txt

Use this file to discover all available pages before exploring further.

The OpenRouter PHP SDK ships with a bundled resources/models.json catalog containing 370+ models from dozens of provider labs. This catalog is loaded at runtime to resolve capability metadata — such as whether a model supports streaming, reasoning, or tool calling — without requiring a separate API call. When you call OpenRouter::model() or OpenRouter::image(), the SDK consults this catalog automatically to answer supports() and capabilities() queries.

Model ID format

All model IDs follow the provider/model-name convention used by the OpenRouter platform. The provider segment is the lab’s slug, and the model name identifies the specific version or variant. Some examples:
Model IDLab
openai/gpt-4oOpenAI
anthropic/claude-sonnet-4Anthropic
google/gemini-3.1-flash-lite-imageGoogle
x-ai/grok-4.3xAI
recraft/recraft-v4.1-vectorRecraft
Alias IDs prefixed with ~ (e.g. ~anthropic/claude-sonnet-latest) are also present in the catalog and resolve to the latest stable version of a given model family.

Text models

Use OpenRouter::model('provider/name') to obtain a TextModelInterface instance backed by a specific model. The instance is backed by OpenRouterTextModel and routes requests through the /api/v1/chat/completions endpoint.
use AiSdk\OpenRouter;

OpenRouter::create(['apiKey' => 'or-...']);

// OpenAI
$model = OpenRouter::model('openai/gpt-4o');

// Anthropic — supports reasoning and extended thinking
$model = OpenRouter::model('anthropic/claude-sonnet-4');

// Google — multimodal with audio and file input
$model = OpenRouter::model('google/gemini-3.5-flash');

// xAI — supports image input and file input
$model = OpenRouter::model('x-ai/grok-4.3');

// DeepSeek — long context reasoning
$model = OpenRouter::model('deepseek/deepseek-v4-pro');
Each of these IDs is present in the bundled catalog with full capability metadata. Pass the returned model instance directly to Generate::text() or any other generation call.

Image models

Use OpenRouter::image('provider/name') to obtain an ImageModelInterface instance backed by OpenRouterImageModel. Image generation requests are routed through the /api/v1/images endpoint.
use AiSdk\OpenRouter;

OpenRouter::create(['apiKey' => 'or-...']);

// Recraft vector illustration model
$model = OpenRouter::image('recraft/recraft-v4.1-vector');

// xAI image quality model
$model = OpenRouter::image('x-ai/grok-imagine-image-quality');

// OpenAI image generation
$model = OpenRouter::image('openai/gpt-image-2');

// Google multimodal image generation
$model = OpenRouter::image('google/gemini-3.1-flash-lite-image');
All four IDs above carry image_generation in their capability list inside the bundled catalog.

Unknown models

If you pass a model ID that is not present in the bundled catalog, the SDK applies a safe fallback: text generation is assumed supported. Internally, when capabilities() returns an empty array for the requested ID, OpenRouterTextModel::capability() returns CapabilitySupport::supported($capability, 'unknown-model-fallback') for Capability::TextGeneration. All other capabilities return unsupported for unknown models, so feature checks like $model->supports(Capability::Streaming) will return false unless the model is in the catalog.
// Model not yet in the catalog
$model = OpenRouter::model('some-new-provider/brand-new-model');

// Text generation: assumed true via fallback
$model->supports(Capability::TextGeneration); // true

// Streaming: unsupported (catalog has no entry)
$model->supports(Capability::Streaming); // false
The bundled catalog reflects the models available at the time the SDK was released and may not include newly-launched models. For the complete, up-to-date list of models supported by the OpenRouter platform, visit openrouter.ai/models.

Build docs developers (and LLMs) love