xAI (Grok) with OpenClaw

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.

Authentication

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).

Basic Configuration

Minimal config
{
  "agent": {
    "model": "xai/grok-2"
  }
}

Model IDs depend on xAI's current catalog. See Configuration guide and OpenClaw provider docs for the latest.

Why xAI Grok for OpenClaw

  • Real-time — Grok has access to live data; good for current-events and research
  • Research-focused — Designed for deep research and long-context tasks
  • Alternative — Diversify from Claude/GPT; useful for failover or A/B testing

Tiered routing

Use a capable model for interactive chat and a cheaper variant (or smaller context window) for scheduled checks. See example setups & model routing.

Grok models in practice

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.

Grok in production

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.