xAI (Grok) with OpenClaw
Configure xAI Grok models — API key
Configure xAI Grok models — API key
xAI (Grok) models are supported in OpenClaw. Grok emphasizes real-time knowledge and research-oriented use cases. Configure via API key from the xAI console. Model IDs and availability may change—check OpenClaw docs and x.ai for current options.
Create an API key at console.x.ai (or xAI's developer portal). Store in ~/.openclaw/credentials or via openclaw secrets. On stable v2026.5.20+, OpenClaw also supports device-code OAuth for xAI—useful on headless servers and remote setups without a localhost browser callback (see v2026.5.20 release notes).
{
"agent": {
"model": "xai/grok-2"
}
}
Model IDs depend on xAI's current catalog. See Configuration guide and OpenClaw provider docs for the latest.
Use a capable model for interactive chat and a cheaper variant (or smaller context window) for scheduled checks. See example setups & model routing.
xAI models work well for fast chat and tool use when latency matters. Pair with x search migration if you moved off legacy web search. Set provider spending caps in the xAI console—OpenClaw does not enforce budgets for you.
Set spending caps in the xAI console. Grok is strong for low-latency chat; pair with search migration if you rely on live web facts. Avoid using the same API key on dev and prod gateways.