Setup
- Get an API key from console.x.ai.
- Set the environment variable:
Configuration
- Inline
- Named model
Available models
| Model | Description | Context |
|---|---|---|
grok-3 | Latest and most capable Grok model | 131K |
grok-3-fast | Faster variant with lower latency | 131K |
grok-3-mini | Compact model for simpler tasks | 131K |
grok-3-mini-fast | Fast variant of the mini model | 131K |
grok-2 | Previous generation model | 128K |
grok-vision | Vision-capable model | 32K |
Thinking budget
Grok models support thinking mode with effort level strings:How it works
xAI is a built-in alias provider:- API type:
openai_chatcompletions - Base URL:
https://api.x.ai/v1 - Token variable:
XAI_API_KEY