Skip to main content

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 is grok-4.

Requirements

Quickstart

Or non-interactive:
Then verify the default model was set:

Configuration

Environment variable

OpenClaw reads 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:
The web search tool uses 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.
Tool schema errors xAI rejects certain JSON Schema keywords in tool definitions. OpenClaw automatically sanitizes tool schemas for xAI — no configuration needed. Model not found
  • Confirm the model ID is correct and your xAI plan includes it.
  • Run openclaw models status to see detected xAI models.