xAI open sourced its coding agent. Apache 2.0, written in Rust, roughly 4,500 GitHub stars in its first weeks. The headlines called it a free alternative to Claude Code.
The client is free. That part is true and it is not nothing.
The model is not free, and at $2 per million input tokens it costs ten times what the model behind Codex CLI costs. Meanwhile Codex CLI is bundled into ChatGPT's free tier at $0.
So the agent everyone is calling free is the expensive one, and the genuinely free one is the one nobody wrote a headline about. Here is what each actually costs to run.
What Grok Build actually is
A full-screen terminal agent written in Rust. xAI announced it on 25 May 2026 as an early beta for SuperGrok and X Premium Plus subscribers, then published the source in mid July 2026 under Apache 2.0.
The feature list is what you would expect if you have used any of these:
- Plan mode. It writes a plan first, and you can approve it, comment on individual steps, or rewrite it before anything executes.
- Parallel subagents. Work is delegated to specialised subagents that run at the same time.
- Headless mode with
-p, for scripts and CI. - Full ACP support, so you can drive it from your own orchestration.
- Your existing conventions work.
AGENTS.md, plugins, hooks, skills and MCP servers all run out of the box.
That last point matters more than the rest. It means switching costs are low in both directions.
The comparison
| Grok Build | Claude Code | Codex CLI | |
|---|---|---|---|
| Client licence | Apache 2.0, source published | Proprietary | Open source |
| Language | Rust | TypeScript | TypeScript |
| Cheapest real path | Pay per token | $20/mo Pro | $0, ChatGPT free tier |
| Subscription tiers | None for the CLI | Pro $20, Max 5x $100, Max 20x $200 | Free $0, Go $8, Plus $20, Pro $100 to $200 |
| Model token cost | Grok 4.6: $2 in / $6 out | Sonnet 4.6: $3 in / $15 out | GPT-5.6 Luna: $0.20 in / $1.20 out |
| Free tier | None for the model | None | Yes |
| Verdict | Free client, expensive model | Best value on a subscription if you code daily | The only one that is free at zero |
Sources: xAI, and the 2026 rate cards for Grok, Claude Code and Codex. GPT-5.6 Luna dropped to $0.20 and $1.20 in the price cut of 30 July 2026.
So is it actually free?
Two different questions are being answered as one.
Is the client free? Yes, genuinely. Apache 2.0, source published, you can read it, fork it, run it against your own endpoint. That is a real and useful thing and xAI deserves credit for it.
Is running it free? No. Every token goes through your xAI account at Grok 4.6 rates. There is no free tier for the model, and authentication is tied to your xAI billing rather than a key you paste in, so metering is not optional.
Now put the numbers side by side. Grok 4.6 output is $6 per million. GPT-5.6 Luna output is $1.20 per million. For the same agent session, the "free" agent costs five times more on output and ten times more on input than the one bundled into a free ChatGPT account.
The client being open source tells you what you may do with it. It tells you nothing about what a session costs.
The 200K cliff nobody mentions
This is the part worth knowing before you point a long-running agent at it.
Grok 4.6 is $2 per million input and $6 per million output below 200K tokens. Once a prompt crosses 200K, xAI bills the entire request at $4 input and $12 output.
Not the overage. The whole thing.
That is exactly the failure mode a coding agent walks into. Agents accumulate context: files read, tool output, previous turns. A session that starts comfortably under the threshold drifts over it during a long refactor, and the moment it does, every token in that request reprices at double.
You will not see this in a quick test. You will see it on the invoice after a week of real work on a large repository.
Mitigations, in order of how much they help: compact aggressively, start fresh sessions rather than letting one run all day, and keep an eye on which files the agent is pulling into context unprompted.
Which one should you actually run?
Codex CLI if cost is the constraint. It is the only one of the three with a genuine free tier, and even paid, GPT-5.6 Luna at $0.20 and $1.20 is the cheapest model of the three by a distance. Start here unless you have a reason not to.
Claude Code if you code daily and want a predictable bill. At $20 a month, Pro is cheaper than per-token billing for anyone using an agent for several hours a day, and the flat number is easier to defend to whoever approves your expenses. There is no free tier, so it is a real decision rather than a trial.
Grok Build if the licence is the point. If you need to fork the harness, run it against your own endpoint, or ship it inside something you control, Apache 2.0 is a genuine differentiator and neither of the others gives you that. Just budget for the model honestly, and watch the 200K cliff.
All three if you are being sensible. AGENTS.md, hooks, skills and MCP servers work across them. The switching cost is close to zero, so there is little reason to pick one forever.
Apache 2.0 buys you portability, not cheap tokens. Those are separate things and only one of them shows up on the bill.
Common mistakes
Reading "open source" as "free to run". The harness and the inference are priced separately. Every agent in this category is cheap to install and none of them are cheap to use hard.
Comparing subscription prices to token prices. $20 a month and $2 per million are not comparable numbers without knowing your volume. Work out your own token usage for a week first, then compare.
Ignoring the 200K threshold. Grok's repricing applies to the whole request, not the excess, so it is a cliff rather than a slope. Long agent sessions on big repositories walk off it routinely.
Assuming the CLI locks you into the model. Grok Build has full ACP support and honours the same conventions the others do. The lock-in is far weaker than the branding suggests.
Testing on a toy repository. All three look fine on a small project. The differences appear on a large codebase where context accumulates, which is also where the pricing differences bite.
Key takeaways
- Grok Build's client is genuinely free and Apache 2.0. The model behind it is not.
- Grok 4.6 is $2 input and $6 output per million. GPT-5.6 Luna is $0.20 and $1.20. The "free" agent runs on a model roughly ten times more expensive on input.
- Codex CLI is the only one of the three with a real free tier, bundled into ChatGPT Free.
- Claude Code has no free tier. It starts at $20 a month on Pro and is good value if you use an agent daily.
- Grok 4.6 reprices the entire request at $4 and $12 once a prompt crosses 200K tokens, which long agent sessions do routinely.
- All three honour
AGENTS.md, hooks, skills and MCP servers, so switching costs are low and picking one forever is unnecessary. - Pick Codex for cost, Claude Code for a predictable monthly bill, Grok Build when you need to own the harness.
If you are wiring one of these into a real workflow rather than using it interactively, the harness matters less than what it is allowed to touch. Our comparison of the agent frameworks covers that layer, and connecting agents to your own systems through MCP covers the plumbing underneath it.


