Grok + Claude Code: the catch
Grok is served by xAI over an OpenAI-compatible API. Claude Code expects the Anthropic Messages API shape, so unlike DeepSeek/Kimi/Qwen (which offer Anthropic-compatible endpoints), Grok usually needs a small proxy that translates between the two. Once that translator is in place, Claude Code can drive Grok like any other endpoint.
The config
What to set
- A translating proxyRun a small proxy that accepts Anthropic-shaped requests and forwards them to xAI's OpenAI-compatible Grok API.
- ANTHROPIC_BASE_URLPoint Claude Code at your local proxy, not directly at xAI.
- ANTHROPIC_AUTH_TOKENYour xAI API key (or whatever the proxy expects), billed to your xAI account.
- ModelSelect a Grok model — the coding-tuned 'code fast' style models are the usual pick for agent work.
Why people want Grok for coding
What Grok brings
| Reason | Detail |
|---|---|
| Speed | xAI's coding-tuned models are built for fast responses |
| Cost | Competitive per-token pricing for routine coding |
| Another fallback | One more provider to switch to when others are capped |
The cleaner option: skip the proxy
Because Grok is OpenAI-compatible, the friction is entirely Claude Code's Anthropic-only assumption. An agent that speaks OpenAI-compatible endpoints natively doesn't need a translating proxy at all — you add Grok as a provider with its base URL and key, and it just works. That removes the extra service and the restart-to-switch dance.
What that looks like with Wuwei
No proxy
OpenAI-compatible providers like xAI/Grok connect directly — no Anthropic-shape translator to run.
Grok in the model list
Pick it next to Claude, DeepSeek, Kimi, Qwen and GLM; switch in a click.
Free, open source, local
MIT-licensed, runs on your machine, reads your real files; you only pay xAI's usage.
FAQ
Can Claude Code use Grok?
Yes, with an extra step. Grok's xAI API is OpenAI-compatible, so Claude Code needs a small translating proxy in front (point ANTHROPIC_BASE_URL at the proxy, use your xAI key, pick a Grok model). Agents that speak OpenAI-compatible endpoints natively skip the proxy.
Is Grok good for coding?
xAI's coding-tuned Grok models are fast and cost-competitive, which makes them a reasonable pick for routine agent coding. As always, test tool-calling on a real task before relying on it for heavy loops.
How do I use Grok without running a proxy?
Use an agent that supports OpenAI-compatible providers directly. Wuwei is free and open source — add Grok with its base URL and key, no translating proxy, and switch to Claude or other models in a click.