Claude Code and Codex do the same job: an agent reads a repository, edits files and runs tests. What differs is whose models sit inside, what they cost and how the agent asks for permission. Claude Code accepts only Claude models, Codex only OpenAI models. Which one is better for your code, a measurement will show, so we give tables, numbers and a method. A broader comparison that includes Cursor is in Codex CLI, Cursor and Claude Code: which to pick. Here we go deeper on the two agents.
What the two have in common and where they differ
Both are available in the terminal, as an app, as an editor extension and on the web. Both read a project rules file, connect to MCP, support skills, subagents and hooks, and run in CI without a dialog. Here is what can be checked, taken from vendor documentation as of October 29, 2026:
| Criterion | Claude Code | Codex |
|---|---|---|
| Model vendor | Anthropic | OpenAI |
| Rules file | CLAUDE.md; if the repo has an AGENTS.md, it can read that instead | AGENTS.md: a global one in ~/.codex plus per-directory files, 32 KiB limit by default |
| Non-interactive run | claude -p "..." | codex exec "..." |
| CI automation | GitHub Actions, GitLab CI/CD, Agent SDK | codex exec, PR review in GitHub (only when signed in with ChatGPT) |
| Extensions | skills, hooks, subagents, MCP, plugins | skills, hooks, subagents, MCP, plugins |
| Editors | VS Code, Cursor, JetBrains | VS Code, Cursor, Windsurf; Xcode and JetBrains have built-in integrations |
| Model context | 1M tokens | about 1.05M tokens for GPT-6 in the API |
| Third-party gateway | ANTHROPIC_BASE_URL, Claude models only | [model_providers.*] with wire_api = "responses" |
The gateway row matters most. The Claude Code documentation says outright that Anthropic does not support pointing Claude Code at non-Claude models through any gateway. So "GPT inside Claude Code" is not an option. "Claude inside Codex" we have not tested and do not recommend.
Models: Opus 5.5, Fable 5.1 and Sonnet 5.5 against Astra, Sol and Luna
In its models overview, Anthropic advises starting with Opus 5.5 and reaching for Fable 5.1 on demanding reasoning and long agentic tasks. In Claude Code the default model on paid plans and on the API is Opus 5.5; you pick Fable by hand with claude --model fable. At OpenAI, going by the Codex models page, Astra is the top model and Sol 6.1 gets close to it for less.
| Vendor price, input / output per 1M | Claude | OpenAI |
|---|---|---|
| $10 / $50 | Fable 5.1 | GPT-6 Astra |
| $4 / $20 | Opus 5.5 | no match at this price |
| $2 / $10 | Sonnet 5.5 | GPT-6.1 Sol |
| $1 / $5 | no match at this price | GPT-6.1 Terra |
| from $0.10 / from $0.50 | Haiku 5.5 | GPT-6 Luna ($0.10 / $0.50) |
The table is ordered by price, not by quality: the same price does not promise the same result. We leave out benchmarks because they are the vendors' own reports, and you can get your own numbers in one evening. The Claude lineup is covered in detail in Claude Opus 5.5, Sonnet 5 and Fable: which to pick, and the GPT lineup in Codex models and What is GPT-6 Astra.
Token prices: vendor and codexkey
Below is the codexkey price list as of October 29, 2026; check the models page for current prices. Next to it are the vendor prices from Anthropic's models overview and from OpenAI's pricing, for short requests.
| Model | Vendor, input / output | codexkey, input / output | codexkey, cache read |
|---|---|---|---|
claude-fable-5-1 | $10 / $50 | $7.48 / $37.44 | $0.76 |
claude-opus-5-5 | $4 / $20 | $0.86 / $4.32 | $0.10 |
claude-sonnet-5-5 | $2 / $10 | $0.52 / $2.6 | $0.06 |
gpt-6-astra | $10 / $50 | $0.68 / $3.3 | $0.08 |
gpt-6.1-sol | $2 / $10 | $0.28 / $1.42 | $0.02 |
gpt-6-luna | $0.10 / $0.50 | $0.04 / $0.22 | $0.04 |
To compare per task rather than per million tokens, take some assumptions (assumptions, not measurements): a task uses 60,000 fresh input tokens, 240,000 tokens from cache and 30,000 output tokens. Cache writes are not counted, and the figures come from the codexkey catalog:
| Model | Cost of one task | 200 tasks a month |
|---|---|---|
claude-fable-5-1 | $1.754 | $350.9 |
claude-opus-5-5 | $0.205 | $41.0 |
claude-sonnet-5-5 | $0.124 | $24.7 |
gpt-6-astra | $0.159 | $31.8 |
gpt-6.1-sol | $0.064 | $12.8 |
gpt-6-luna | $0.019 | $3.7 |
The main takeaway: on this profile Sonnet 5.5 costs about twice as much as GPT-6.1 Sol, and Fable 5.1 costs more than eight times as much as Opus 5.5, its nearest neighbor by price. Cheaper does not mean better. A model that costs more per token but solves the task on the first attempt works out cheaper. For orientation, Anthropic's cost documentation gives an average of about $13 per developer per active day and $150-250 a month. It was calculated from enterprise customers and at Anthropic's own prices.
Subscriptions and limits
Both agents run on a subscription or on a key. Prices from Anthropic's page and the Codex page as of October 29, 2026:
| Tier | Claude | ChatGPT with Codex |
|---|---|---|
| Free | Claude Code not included | Free and Go: GPT-6 Luna in the app |
| Entry paid | Pro: $20 a month, $17 when billed yearly | Plus: $20 a month |
| Top | Max 5x and 20x: from $100 | Pro: from $100 (tiers: $100, $200, $500) |
| Teams | Team: Standard $20-25, Premium $100-125 per seat | Business: $20-25 per user |
In both cases limits are tied to windows. Claude subscribers see messages about a session limit and a weekly limit. For Codex on Plus, OpenAI estimates the five-hour limit like this: Astra 5-45 messages, GPT-6.1 Sol 15-160, Luna 350-3000; on Pro the five-hour limit does not apply at the moment. We did not find message counts for Claude on the pricing page. How the windows work is covered in Claude limits: Pro, Max and Claude Code and Codex limits. If the windows get in the way, an API key removes them: you pay for tokens, and the gateway's restrictions are described in the codexkey documentation.
One key for both agents
Both tools connect to codexkey with one sk_cdx_... key, with no vendor account and no VPN. You can pay with a Russian bank card, through SBP (the Russian Faster Payments System) or with crypto.
Claude Code takes the address without /v1 and the key from environment variables:
export ANTHROPIC_BASE_URL="https://api.codexkey.online"
export ANTHROPIC_AUTH_TOKEN="sk_cdx_YOUR_KEY"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-5-5[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-5[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5"
claude --model claude-opus-5-5
The ANTHROPIC_DEFAULT_* lines are required: without them Claude Code asks for its own default models and gets "There's an issue with the selected model".
Step-by-step setup is in the Claude Code guide, and the article on Claude Code in Russia gives the wider picture of access from Russia.
Codex reads ~/.codex/config.toml: it needs the address with /v1 and a key from auth.json or from a variable:
model = "gpt-6.1-sol"
model_provider = "codexkey"
[model_providers.codexkey]
name = "codexkey"
base_url = "https://api.codexkey.online/v1"
wire_api = "responses"
requires_openai_auth = true
The key goes into ~/.codex/auth.json in the OPENAI_API_KEY field; details are in the Codex guide.
Agent behavior: confirmations and sandbox
The differences here are documented, and they are worth weighing when you choose. In manual mode Claude Code by default asks permission for shell commands (except a set of safe read-only ones) and for file changes; reading inside the working folder goes without questions. In a folder under Git, Codex starts in Auto mode: it writes to the working folder and runs commands in a sandbox without asking, and asks for confirmation when it has to step outside, for example to enable the network or edit files outside the project. Outside Git it only reads by default.
The practical upshot: in the default setup Claude Code asks more questions at the start, while Codex asks fewer but is confined to the sandbox. Both modes can be tuned in either direction. If the agent runs unattended, check the access settings before the first overnight task, not after.
The rest of the behavior (editing style, a tendency toward extra changes, knowing when to stop) depends on the model and the prompt. We will not make loud claims without measuring.
How to compare on your own repository
You need a method you can repeat in an evening:
- Pick 10 closed tasks from your repository that already have a test: bugs, small features, one refactoring.
- For each task, create a clean branch from the commit just before the fix.
- Put identical rules in the repository: the same text in
CLAUDE.mdandAGENTS.md, the same build and test commands. - Run both agents with the same prompt, on models at the same price (for example Sonnet 5.5 and GPT-6.1 Sol: both $2 and $10 per 1M tokens) and at a medium reasoning level.
- In every run, record whether the test passed, how many minutes it took, how many times you had to step in and how many tokens were spent. Tokens are shown by
/usagein Claude Code and/statusin Codex. - Divide the cost of all runs by the number of solved tasks. That is the cost per solved task, and it is the only fair basis for comparison.
Then repeat on the top pair (Fable 5.1 and Astra), but only on the tasks the smaller models failed. Do three runs per task to see the spread: agent results are unstable.
What to pick by scenario
| Situation | Where to start | Why |
|---|---|---|
| You specifically need Claude models (Opus, Fable) | Claude Code | Anthropic does not support other models in it |
| You need GPT-6, and the repo already has AGENTS.md | Codex | OpenAI's native tool |
| Tight budget, lots of routine edits | Codex on gpt-6.1-sol or gpt-6-luna | the codexkey catalog gives a lower cost per task |
| Hard debugging, one expensive failure | both agents on top models | compare the cost per solved task |
| You need a plugin with interactive diffs in JetBrains | Claude Code | in JetBrains, Codex has its own chat-style integration |
| Cloud PR review in GitHub | depends on the subscription | both have it; Codex only when signed in with ChatGPT |
We would not pick one tool for good. A workable setup is to keep both on one key and give each task to whichever has the lower cost per solved task on your tests.
FAQ
Claude Code or Codex: which is better?
There is no single answer. Claude Code runs Claude models and Codex runs OpenAI models, so the argument is really about models, price and your team's habits. Run both agents on 10 of your own tasks and compare the cost per solved task.
How do Claude Code and Codex differ on price?
At vendor list prices, Astra costs the same as Fable 5.1 ($10 and $50 per 1M tokens), and GPT-6.1 Sol the same as Sonnet 5.5 ($2 and $10). In the codexkey catalog, on the same task profile, GPT-6.1 Sol is about half the price of Sonnet 5.5. Subscriptions for both start at $20 a month.
Can I run GPT in Claude Code or Claude in Codex?
You cannot run GPT in Claude Code: Anthropic does not support pointing Claude Code at non-Claude models. We have not tested Claude in Codex and do not recommend it. The practical route is to install both agents and connect them to one codexkey key.
Which is better on Windows?
Both run natively on Windows. Claude Code installs from PowerShell or CMD, and Git for Windows is recommended. Codex runs in PowerShell inside a sandbox and recommends Windows 11. A separate article on Codex CLI on Windows covers installing Codex.
Do I need a subscription to use these agents?
No. Both accept an API key. Claude Code works through a key and the address https://api.codexkey.online, Codex through https://api.codexkey.online/v1. Without a subscription you lose what is tied to the vendor account: for Codex that is cloud tasks and GitHub review, for Claude Code, for example, Remote Control when running through a gateway.
How do I work out which is cheaper?
Multiply token usage by the model price, allowing for cheap cache reads, and divide by the number of solved tasks. Take usage from /usage in Claude Code and /status in Codex. Compare the cost per solved task, not the price of a million tokens.