TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/xai/llms.txt
Use this file to discover all available pages before exploring further.
aisdk/xai provider ships a bundled model catalog (resources/models.json) that maps every supported Grok model ID — or ID prefix — to its modality, status, and capability set. When you pass a model ID to XAI::model() or XAI::image(), the provider resolves that ID against the catalog at runtime so that capability checks are always based on the official catalog definition rather than hard-coded values in your application code.
Text models
The catalog contains three wildcard text-model families. The* suffix is a prefix-match wildcard: any model ID that starts with the listed prefix resolves to that catalog entry. For example, grok-4, grok-4-turbo, and grok-4.3 all match the grok-4* entry.
| Model pattern | Status | Modality |
|---|---|---|
grok-4* | stable | text |
grok-3* | stable | text |
grok-2* | stable | text |
Image models
| Model ID | Status | Modality |
|---|---|---|
grok-imagine-image-quality | stable | image |
grok-imagine-image-quality is xAI’s dedicated image-generation model. It accepts both text prompts and image inputs and returns generated images via the /v1/images/generations endpoint. Unlike text models it does not expose streaming, tool calling, or structured output.
Using a model
Instantiate any model by passing its exact ID (text) or the fixed image model ID to the appropriate factory method on theXAI facade:
XAI::model() returns a TextModelInterface backed by XAITextModel, while XAI::image() returns an ImageModelInterface backed by XAIImageModel. Both classes resolve capabilities from the catalog automatically.
Fallback behaviour
If you pass a model ID that does not match any catalog entry — for example, a brand-new model that was released after the installed version ofaisdk/xai — the provider does not throw an error. Instead, XAITextModel::capability() detects that the catalog returned an empty capability list for the unknown ID and returns a supported CapabilitySupport value for Capability::TextGeneration with the source set to unknown-model-fallback. This means you can immediately use a newly released Grok text model without upgrading the package; only the capability introspection will be incomplete until the catalog is updated.
Model IDs are forwarded directly to the xAI API without modification. Always check the official xAI documentation at https://docs.x.ai for the latest model names, as new models or renamed variants may not yet appear in the bundled catalog.