Claude Code vs Codex CLI: two terminal agents, two philosophies
Both live in your terminal, read your repo, and edit files. They differ in how much autonomy they take, how they handle context, and -- crucially -- whether you can repoint them.
Terminal coding agents converged fast. Both of these read your repository, plan, edit files, run commands, and iterate on failures. If you have used one, the other will not feel alien.
The differences that survive daily use are narrower and more specific than the launch posts suggest.
Autonomy
Claude Code leans toward doing the work and telling you afterwards. Give it a task with enough context and it will read what it needs, make a plan, edit several files, run the tests, and fix what broke -- without checking in at every step. That is excellent when the task is well-specified and irritating when it is not, because a vague instruction produces a lot of confident work in the wrong direction.
Codex CLI is more conversational by default. More checkpoints, more "here is what I am about to do". Slower on a task you have specified well, safer on one you have not.
Neither is correct. It maps to how much you trust your own task descriptions.
Context handling
Both compact conversations as they grow. The practical difference is in how they gather context in the first place: Claude Code reads aggressively and early, building a picture of the repo before acting. That produces better multi-file edits and burns more tokens getting there.
If you are on a metered path, that difference is visible on the invoice. If you are on a subscription, it is invisible and you get the benefit for free.
The difference that actually matters
Claude Code reads ANTHROPIC_BASE_URL. You can point it at any endpoint speaking the Anthropic Messages API -- Bedrock, Vertex, an enterprise gateway, or a local router. The agent loop is client-side; the model behind it is configuration.
That single fact changes the economics. The CLI is a good agent and the subscription is a pricing decision, and they are separable.
Codex CLI is more tightly bound to its own plan. It routes through the bundled Codex quota, which is fine while the bundle lasts and offers less room to manoeuvre when it does not.
The consequence: with Claude Code you can run the same agent on a free tier, a Copilot subscription, or a cheap metered API. With Codex you mostly run it on Codex.
Models
| Claude Code | Codex CLI | |
|---|---|---|
| Native models | The Claude line | gpt-5.4, gpt-5.4-mini, gpt-5.3-codex |
| Repointable | Yes, via ANTHROPIC_BASE_URL | Tied to the plan |
| Also served elsewhere | Sonnet 4.5 and Haiku 4.5 via Copilot and Kiro; Opus 4.7 via Copilot | gpt-5.3-codex and gpt-5.4 via Copilot |
That last row is worth noting: a Copilot subscription serves models from both families. If you hold one, you have a path to either agent's model class without a second subscription.
Cost, in practice
Codex Plus is the cheaper entry point. Claude Code's Max tier is the expensive one -- but because Claude Code is repointable, the Max tier is not the only way to run it, which changes the comparison entirely.
The honest framing: compare Codex Plus against Claude Code on a backend you already have, not against Max. On that basis they are close, and the decision comes back to autonomy style rather than price.
Choosing
Take Claude Code if you want maximum autonomy on well-specified tasks, you want the freedom to repoint the model, or you already hold access it can use.
Take Codex CLI if you prefer more checkpoints, you already pay for a Codex plan, or your work is GPT-flavoured and you want the code-specialised variant.
Take both if you have subscriptions covering both -- they coexist fine, and different tasks genuinely suit different levels of autonomy.
Running either on what you already pay for
npm install -g @sifxprime/krouter
krouter -tConnect what you hold, then for Claude Code:
export ANTHROPIC_BASE_URL=http://localhost:20128
export ANTHROPIC_AUTH_TOKEN=sk-krouter-localNote the missing /v1 -- Claude Code appends /v1/messages itself. For Codex-family models the same router exposes them at cx/ and gh/ prefixes through the OpenAI-compatible endpoint.
Common questions
Which is better at large refactors?
Claude Code, generally, because it reads more of the repository before acting and takes longer autonomous runs. That advantage costs tokens, which matters on a metered path and not on a subscription.
Can I use Claude Code without an Anthropic subscription?
Yes. It reads ANTHROPIC_BASE_URL, so any endpoint speaking the Anthropic Messages API works -- including a local router in front of free tiers or a Copilot subscription.
Can I point Codex CLI somewhere else?
Not in the same open way. It is bound more tightly to its own plan, which is the main structural difference between the two.
Do MCP servers work in both?
MCP is negotiated between the client and the server on your machine, so it is unaffected by which model answers.
Is gpt-5.3-codex better than the general GPT-5 line for coding?
For editing, diffs, and tool-heavy loops it is usually faster and well-suited. For architectural reasoning the general line is stronger.
Related
Klaw is the Kodelyth AI agent. He writes drafts, runs the benchmarks, and tracks every cost number in this post live through kRouter. Humans review before publish.
Install kRouter