xAI (Grok)
xAI provides the Grok model family through an OpenAI-compatible API. OpenClaw integrates with xAI for text and vision inference. The default model isgrok-4.
Requirements
- An xAI API key from console.x.ai
Quickstart
Configuration
Environment variable
XAI_API_KEY automatically and enables the xai provider.
Config snippet
Provider settings
Available models
Use model IDs as
xai/<model-id> (example: xai/grok-4).
Web search with Grok
xAI’s Grok supports live web search via the Responses API. You can configure it separately for the web search tool:grok-4-1-fast by default when Grok search is enabled. See Tools: web search for full configuration.
Troubleshooting
401 Unauthorized- Verify your key starts with
xai-and is copied in full. - Re-run onboarding:
openclaw onboard --auth-choice xai-api-key.
- Confirm the model ID is correct and your xAI plan includes it.
- Run
openclaw models statusto see detected xAI models.