Skip to main content

Documentation Index

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

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

Before dispatching any request the SDK inspects the target model’s declared capabilities and compares them against what the request actually needs. If the model does not support a required capability — and you have not opted into it via assume() or allowUnknownCapabilities() — a MissingCapabilityException is raised before any HTTP call is made. This keeps errors fast, local, and descriptive.

The Capability enum

Capability is a pure PHP enum (no backing type). Each case represents one discrete feature a model can advertise.
CaseName stringWhat it means
TextGenerationtext_generationThe model can produce text completions. Required for all Generate::text() calls.
StreamingstreamingThe model supports token-by-token streaming via ->stream().
ToolCallingtool_callingThe model can invoke structured tools and return tool-call payloads.
StructuredOutputstructured_outputThe model can return output conforming to a JSON schema via ->output().
ReasoningreasoningThe model exposes a reasoning/thinking trace alongside its response.
ImageGenerationimage_generationThe model can generate images. Required for all Generate::image() calls.
TextInputtext_inputThe model accepts plain text as input content.
ImageInputimage_inputThe model accepts image content parts (also aliased as vision).
AudioInputaudio_inputThe model accepts audio content parts.
FileInputfile_inputThe model accepts arbitrary file content parts.
Capability::fromName() resolves a snake_case string to a case. The alias 'vision' maps to ImageInput for backwards-compatibility with model catalogs that predate the unified naming scheme.

How required capabilities are derived

PendingTextRequest inspects the fully-built request to determine the minimum capability set before it calls ModelResolver::resolve():
  • TextGeneration is always required.
  • Streaming is appended when you call ->stream() instead of ->run().
  • StructuredOutput is required when ->output() has been set.
  • ToolCalling is required when at least one tool has been registered.
  • Reasoning is required when ->reasoning() has been called.
  • TextInput, ImageInput, AudioInput, or FileInput are added based on the Content types present in the message array.
Generate::image() always requires ImageGeneration.

Querying a model’s capabilities

Boolean check

use AiSdk\Capability;

$model = $provider->textModel('acme-ultra-v2');

if ($model->supports(Capability::ToolCalling)) {
    echo "Tool calling is available.\n";
}

if ($model->supports(Capability::ImageInput)) {
    echo "You can send images to this model.\n";
}

Rich capability object

capability() returns a CapabilitySupport value object with additional context:
use AiSdk\Capability;

$support = $model->capability(Capability::Reasoning);

echo $support->state->value;    // 'supported', 'not_supported', or 'adapted'
echo $support->source ?? 'n/a'; // e.g. 'AcmeTextModel', 'user-assumed'
echo $support->strategy ?? '';  // only set for Adapted state

CapabilitySupport and CapabilitySupportState

CapabilitySupport is an immutable value object produced by the three factory methods below.
// Model declares the capability natively:
CapabilitySupport::supported(Capability $capability, ?string $source = null): CapabilitySupport

// Model does not support the capability:
CapabilitySupport::notSupported(Capability $capability, ?string $reason = null): CapabilitySupport

// Provider adapter simulates the capability (e.g. JSON-mode for structured output):
CapabilitySupport::adapted(Capability $capability, string $strategy, ?string $source = null): CapabilitySupport
CapabilitySupportState is the backing enum with three cases:
CaseValueMeaning
Supported'supported'Model natively supports the capability.
NotSupported'not_supported'Model does not support the capability.
Adapted'adapted'Capability is emulated by the provider adapter with a specific strategy.
isSupported() returns true for both Supported and Adapted — the caller does not need to distinguish between native and emulated support unless auditing the strategy.
$support = $model->capability(Capability::StructuredOutput);

// True for Supported and Adapted; false only for NotSupported.
if ($support->isSupported()) {
    $result = Generate::text()
        ->model($model)
        ->prompt('Return a user object.')
        ->output($schema)
        ->run();
}

Listing all capabilities a model exposes

$capabilities = $model->capabilities();

foreach ($capabilities as $capability) {
    echo $capability->name() . "\n";
    // text_generation, text_input, streaming, tool_calling, …
}
Capability::fromName() accepts both the canonical snake_case name and the legacy alias 'vision' for ImageInput. All other cases have exactly one canonical name. Provider catalog JSON files should use the canonical names.

Build docs developers (and LLMs) love