xAI / Grok
Use the xai provider for xAI Grok models. xAI supports both web_search and x_search; fast-agent sends x_search as xAI's provider-managed X Search tool.
Sign in with a Grok/X subscription
The device login opens an xAI verification URL and displays a code. Provider
credentials use the OS keyring when it is writable and otherwise fall back to
~/.fast-agent/auth.json. Access tokens refresh automatically before expiry.
The model selector also offers this login when an xAI model is selected without a configured credential.
Useful credential commands:
fast-agent auth status xai
fast-agent auth token xai
fast-agent auth export xai ./xai.auth.json
fast-agent auth logout xai
An exported file contains only the selected provider and includes its refresh
token. Set FAST_AGENT_AUTH_FILE to use that portable file. This is the
recommended form for long-running Harbor jobs because refreshed credentials are
written back to the staged file.
Configure
Environment variables:
XAI_API_KEY: Your xAI API keyXAI_BASE_URL: Override the API endpointFAST_AGENT_AUTH_FILE: Explicit portable provider credential file
An explicit xai.api_key or XAI_API_KEY takes precedence over stored OAuth.
Use a model
fast-agent --model "xai.grok-4.3?reasoning=high"
fast-agent --model "xai.grok-4.3?web_search=on"
fast-agent --model "xai.grok-4.3?x_search=on"
fast-agent --model "xai.grok-4.5"
Reasoning and search tools
Useful xAI query parameters:
reasoning=none|low|medium|highon reasoning-capable Grok modelsweb_search=on|offfor xAI web searchx_search=on|offfor xAI's X Search remote tool
web_search and x_search are distinct provider-managed tools.
Capabilities
Capabilities are model-dependent. See Models Reference for fast-agent's known structured output, reasoning, modality, and tool metadata.
Model aliases
| Model Alias | Maps to | Model Alias | Maps to |
|---|---|---|---|
grok |
xai.grok-4.5 |
grok4 |
xai.grok-4.5 |
grok-4.3 |
grok-4.3 |
grok43 |
xai.grok-4.3 |
grok-4.5 |
grok-4.5 |
grok45 |
xai.grok-4.5 |