xAI (Grok)
xAI provides the Grok model family through an OpenAI-compatible API. WednesdayAI integrates with xAI for text and vision inference. The default model isgrok-4.
Prerequisites
- An xAI API key from console.x.ai
Quick setup
1. Get an API key
Sign in to console.x.ai and create an API key. Keys start withxai-.
Store it on the gateway host:
2. Run onboarding
3. Configure
apiKey is the name of the environment variable, not the key value itself. Keep secrets in .env, not in committed config files.Provider settings
| Setting | Value |
|---|---|
| Provider ID | xai |
| Base URL | https://api.x.ai/v1 |
| API | OpenAI-compatible |
| Auth env var | XAI_API_KEY |
| Default model | grok-4 |
| Default context window | 256,000 tokens |
Verification
Available models
| Model ID | Context | Notes |
|---|---|---|
grok-4 | 256K | Default; reasoning |
grok-4-fast | 2M | Reasoning; vision |
grok-4-fast-non-reasoning | 2M | Vision |
grok-4-1-fast | 2M | Reasoning; vision |
grok-4-1-fast-non-reasoning | 2M | Vision |
grok-code-fast-1 | 256K | Reasoning; coding |
grok-3 | 131K | |
grok-3-latest | 131K | |
grok-3-fast | 131K | |
grok-3-mini | 131K | Reasoning |
grok-3-mini-fast | 131K | Reasoning |
grok-2 | 131K | |
grok-2-vision | 8K | Vision |
xai/<model-id> — for example, xai/grok-4.
Run openclaw models list --provider xai for the full current catalog.
Web search with Grok
Grok supports live web search. Configure it separately for the web search tool:grok-4-1-fast by default when Grok search is enabled.
Troubleshooting
401 Unauthorized
401 Unauthorized
Tool schema errors
Tool schema errors
xAI rejects certain JSON Schema keywords in tool definitions. WednesdayAI automatically sanitizes tool schemas for xAI — no configuration needed.
Model not found
Model not found
Confirm the model ID is correct and your xAI plan includes it. Run
openclaw models status to see detected xAI models.