Claude Code vs Codex CLI in November 2026: An Honest Head-to-Head
As of 2026-11-25, Claude Code (Anthropic, v2.1.33x) and Codex CLI (OpenAI, 0.172.0) are both mature terminal coding agents. Claude Code defaults to Claude Opus 5.5 and can switch to Sonnet 5.5 or Fable 5.2; Codex CLI has defaulted to GPT-6.2 Sol since 0.171.0, with GPT-6.2 Astra as the top option. The short answer: pick Claude Code for interactive refactoring, debugging and code review; pick Codex for sandboxed autonomous runs, bulk generation and CI. Plenty of teams use both, and a single key that speaks both protocols can drive both tools.
QCode is an independent third-party API service with no official or partner relationship with Anthropic or OpenAI. Prices below are the vendors' list prices with dates; live prices on QCode are on /models.
Updated 2026-11-26
Key facts
- Default models: Claude Code subscribers have defaulted to Opus 5.5 since 2026-09-22 ($4 / $20 per million tokens, per Anthropic). Codex CLI 0.171.0 (2026-11-20) made GPT-6.2 Sol the default ($2 / $10, per OpenAI).
- Different protocols: Claude Code speaks the Anthropic Messages API; Codex CLI speaks the OpenAI Responses API. Claude models do not run in Codex, and GPT models do not run in Claude Code.
- Different config styles: Claude Code uses environment variables (or the
envblock in~/.claude/settings.json); Codex CLI uses~/.codex/config.tomlplusauth.json. - Adoption: JetBrains' Developer Ecosystem Survey 2026 (15,000+ professional developers, May–July 2026) found about 39% using Claude Code at work (18% in January) and 16% using Codex (3% in January). Codex is the fastest grower.
- Cost: Sonnet 5.5 and GPT-6.2 Sol have identical list prices. Opus 5.5 costs about 2x that, Fable 5.2 and GPT-6.2 Astra about 4x (by input/output unit price).
Side-by-side overview (2026-11-25)
| Dimension | Claude Code | Codex CLI |
|---|---|---|
| Vendor | Anthropic | OpenAI |
| Latest version | v2.1.33x (check the official changelog) | 0.172.0 (2026-11-24, official changelog) |
| Default model | Opus 5.5 (subscribers, since 2026-09-22) | GPT-6.2 Sol (since 0.171.0) |
| Flagship | Fable 5.2 (released 2026-11-09, 1M context, 128K output) | GPT-6.2 Astra (released 2026-11-17) |
| API protocol | Anthropic Messages | OpenAI Responses |
| Config | Env vars / ~/.claude/settings.json |
~/.codex/config.toml + ~/.codex/auth.json |
| Project instructions | CLAUDE.md (falls back to AGENTS.md) |
AGENTS.md |
| Safety model | Permission rules + permission modes + optional Bash sandbox | Kernel-level sandbox + approval policy |
| Source | Closed source | Apache-2.0 |
Models and prices: Opus 5.5 / Sonnet 5.5 / Fable 5.2 vs GPT-6.2 Sol / Astra
Vendor list prices in USD per million tokens (Anthropic and OpenAI pricing pages, read 2026-11-25). QCode currently bills Anthropic and OpenAI models at official price x1.0; check /models for live rates.
| Model | Tool | Input | Cache hit | Output | Notes |
|---|---|---|---|---|---|
claude-sonnet-5-5 |
Claude Code | $2 | $0.10 | $10 | Released 2026-09-28; the value workhorse |
claude-opus-5-5 |
Claude Code | $4 | $0.20 | $20 | 1M context; cheaper than Opus 5 ($5 / $25) |
claude-fable-5-2 |
Claude Code | $8 | $0.20 | $40 | Fast mode $16 / $80 |
gpt-6.2-sol |
Codex CLI | $2 | $0.10 | $10 | Codex default |
gpt-6.2-astra |
Codex CLI | $8 | $0.40 | $40 | Hardest multi-step agent work |
Three things the unit prices hide:
- Claude charges a cache-write premium: 1.25x the input price for a 5-minute write and 2x for a 1-hour write (per Anthropic's pricing page). OpenAI does not bill cache writes separately.
- GPT-6.2 long-context surcharge: when a single request exceeds 272K input tokens, the whole request is billed at 2x input and 1.5x output (as reported by Requesty).
- Tokenizers differ: Anthropic notes that the Claude 4.7+ tokenizer produces roughly 30% more tokens for the same text, so per-token prices understate the real gap.
On capability, third-party results are mixed. On the Artificial Analysis Intelligence Index, Fable 5.2 scores 65, GPT-6.2 Astra 62 and Sol 57; on its Coding Agent Index, Astra is flat versus its predecessor and Sol is slightly down (per Requesty's November 2026 roundup). Treat benchmarks as a hint and run your own repository before you decide.
Configuration: environment variables vs config.toml
Claude Code
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. The cleanest place is ~/.claude/settings.json (%USERPROFILE%\.claude\settings.json on Windows):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.qcode.cc/api",
"ANTHROPIC_AUTH_TOKEN": "cr_your_key"
}
}
Common pitfalls: no trailing slash on the base URL (it becomes //v1/messages and returns 404); don't set ANTHROPIC_API_KEY at the same time; settings.json is strict JSON, so no comments or trailing commas. To pin a model, use ANTHROPIC_MODEL (forced on every launch) or /model claude-sonnet-5-5 inside a session.
Codex CLI
Codex CLI reads ~/.codex/config.toml:
model_provider = "qcode"
model = "gpt-6.2-sol"
model_reasoning_effort = "high"
approval_policy = "on-request"
sandbox_mode = "workspace-write"
[model_providers.qcode]
name = "qcode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
Put the key in ~/.codex/auth.json:
{ "OPENAI_API_KEY": "cr_your_key" }
If you prefer an environment variable, replace requires_openai_auth = true with env_key = "QCODE_API_KEY"; use one method, not both. Don't add /v1 or a trailing slash to base_url. GPT-6.2 models reject the none reasoning effort, so keep high or xhigh.
Feature comparison
| Feature | Claude Code | Codex CLI |
|---|---|---|
| Subagents | Define specialists in .claude/agents/ with their own model and effort; Agent Teams |
agents.enabled on by default, spawn_agent capped at 16; define roles with agents.<name> |
| Hooks | hooks in settings.json: PreToolUse, PostToolUse, Stop and more; hooks can block on failure |
Enable with features.hooks, configure in hooks.json or a [hooks] table: PreToolUse, PostToolUse, SessionStart, Stop, UserPromptSubmit and more |
| MCP | claude mcp add; MCP servers can ship skills |
[mcp_servers.<id>] with command / args or url |
| Plan mode | Plan Mode (Shift+Tab) proposes a plan before editing | Plan mode, with its own plan_mode_reasoning_effort |
| Sandbox and approvals | permissions allow / ask / deny rules; /sandbox turns on the Bash sandbox (Seatbelt on macOS, bubblewrap on Linux/WSL2; off by default; not on native Windows) |
sandbox_mode: read-only / workspace-write / danger-full-access; approval_policy: on-request / never; Landlock + seccomp on Linux |
| Headless / CI | claude -p |
codex exec; codex exec --remote added in 0.171.0 |
| Background / scheduled | /loop and scheduled tasks |
Remote sessions via /remote and /rc |
| IDE and desktop | VS Code and JetBrains extensions, desktop app | Codex app and IDE extension |
The philosophies differ. Claude Code behaves like a pair programmer that discusses first and then acts, with fine-grained permission prompts; it shines at architecture changes and hard debugging in large codebases. Codex CLI puts commands in a sandbox by default (network off in workspace-write), which suits "let it run, then review" batch work and pipelines.
A handy trick: if your repo already has CLAUDE.md, add project_doc_fallback_filenames = ["CLAUDE.md"] to Codex's config.toml so Codex reads it when AGENTS.md is missing. In the other direction, Claude Code reads AGENTS.md when there is no CLAUDE.md (in recent versions). One instruction file can serve both tools.
Cost on one QCode key
Here is the arithmetic for a hypothetical mid-size refactor (an illustration, not a measurement): 3M input tokens in total, 2.4M of them cache hits and 0.6M uncached, plus 150K output tokens. List prices, cache-write premium not included:
| Model | Uncached input | Cache hits | Output | Total |
|---|---|---|---|---|
| Sonnet 5.5 | $1.20 | $0.24 | $1.50 | $2.94 |
| GPT-6.2 Sol | $1.20 | $0.24 | $1.50 | $2.94 |
| Opus 5.5 | $2.40 | $0.48 | $3.00 | $5.88 |
| Fable 5.2 | $4.80 | $0.48 | $6.00 | $11.28 |
| GPT-6.2 Astra | $4.80 | $0.96 | $6.00 | $11.76 |
Real-world differences also depend on the tool: the same request consumes different token counts in each agent, and reasoning effort, subagent count and cache hit rate matter more than unit price. Run each tool on your own project for a week and compare the usage breakdown in the QCode dashboard.
Take QCode's Daily 35 plan: $35 of quota per day (reset at 00:00 Beijing time). With the numbers above, that covers roughly 11 Sonnet 5.5 or GPT-6.2 Sol tasks, or 5–6 Opus 5.5 tasks, per day. Claude Code and Codex CLI draw from the same quota, so you don't need two vendor subscriptions.
Which one to choose, by scenario
| Scenario | Pick | Why |
|---|---|---|
| Refactoring a large legacy codebase, cross-module debugging | Claude Code + Opus 5.5 | Careful interaction, clear permission prompts, long context |
| Everyday features and tests | Claude Code + Sonnet 5.5 or Codex + GPT-6.2 Sol | Lowest unit price, fast |
| Scaffolding, docs, bulk edits | Codex CLI + GPT-6.2 Sol | Autonomous runs in a sandbox; fits codex exec |
| Auto-fix in CI | Codex (codex exec) or Claude Code (claude -p) |
Both have headless modes; follow team habit |
| Hardest reasoning and system design | Fable 5.2 or GPT-6.2 Astra | About 4x the workhorse price; switch in when needed |
| Using Chinese models | Claude Code + glm-5.3 and others |
Chinese models work on both protocols at QCode; rates are on /models |
| Mixed team using both tools | Install both, share one key | One bill, one usage view |
Using both tools with one key
A single QCode key (it starts with cr_) supports both the Anthropic and OpenAI protocols; the request path decides which:
# Claude Code: Anthropic protocol
export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_your_key
claude
# Codex CLI: after writing ~/.codex/config.toml and auth.json as in section 3
codex
If you switch configs often, CC Switch manages endpoints and keys for both tools (see the CC Switch guide). Users in Asia can swap the host for asia.qcode.cc; North America and Europe can use us.qcode.cc.
Common pitfalls when running both
- Mixed-up protocols: putting
https://api.qcode.cc/openai/v1into Claude Code, or writingmodel = "claude-opus-5-5"in Codex, ends in a 404 or model-not-found error. Claude goes over Anthropic, GPT over OpenAI. - Stale environment variables: variables inherited from your system or shell override config files. If you get a 401 after changing keys, look for an old
ANTHROPIC_AUTH_TOKENorANTHROPIC_API_KEY. - Two auth methods in Codex: with
requires_openai_auth = true, Codex ignoresenv_key. Keep one. - Switching models mid-session: each model has its own prompt cache, so the first request after a switch re-reads the whole context at the uncached price. Try to finish a task on one model.
- Reasoning effort set too high: Codex
xhighand high effort in Claude Code both add a lot of output tokens. Default orhighis enough for routine work. - Runaway subagents: both tools can fan out parallel subagents, which can multiply a task's cost. Give subagents a cheaper model (Sonnet 5.5 or GPT-6.2 Sol) and watch your daily quota.
- Windows and Notepad: Codex config lives in
%USERPROFILE%\.codex\; make sure Notepad doesn't save it asconfig.toml.txt.
FAQ
Which is better for beginners, Claude Code or Codex?
Claude Code explains its plan before editing, which makes it easier to follow. Codex CLI's stricter default sandbox lowers the risk of a bad command. Both install in minutes, so try each for a day.
Can I use Claude models in Codex CLI?
No. Codex CLI uses the OpenAI Responses protocol, and Claude models are only served over the Anthropic Messages protocol. Use Claude Code (or another Anthropic-protocol tool) for Claude, and Codex for GPT-6.2.
Is Opus 5.5 or GPT-6.2 Sol better for coding?
Opus 5.5 ($4 / $20) lists at twice the price of Sol ($2 / $10). Third-party evaluations disagree, and some developers still prefer Opus 5.5 for development work, while Sol is cheaper and fast. The reliable answer comes from running real tasks from your own repo on both.
Can both tools share one instruction file?
Yes. Claude Code reads AGENTS.md when CLAUDE.md is absent, and Codex can read CLAUDE.md via project_doc_fallback_filenames = ["CLAUDE.md"]. Keep one file.
Do I need two keys to use both tools on QCode?
No. One key supports both the Anthropic and OpenAI protocols, both tools share your plan's daily quota, and usage appears on one bill.
Should base_url in Codex config.toml end with /v1?
No. In Codex CLI use https://api.qcode.cc/openai with wire_api = "responses". Only generic OpenAI-compatible clients use https://api.qcode.cc/openai/v1.
Should I default to Fable 5.2?
Fable 5.2 costs 4x Sonnet 5.5 per token, so reserve it for the hardest problems. Default to Sonnet 5.5 or Opus 5.5 and switch with /model claude-fable-5-2 when you're stuck.
One plan for both tools
If you use Claude Code or Codex every day, the Daily 35 plan fits: $53.57 per 30 days for $35 of quota per day, reset at 00:00 Beijing time, shared by Claude Code and Codex CLI. Anthropic and OpenAI models are billed at official price ×1.0; Chinese models at the rate shown on /models. Not sure about your volume? See the other tiers on /pricing and per-model rates on /models.