Codex vs Claude Code: The Cost Structure Comparison
Codex bills through flat ChatGPT plan windows; Claude Code meters programmatic use through Agent SDK credits or API keys. The structures and policies, compared.
Codex and Claude Code get compared on model quality everywhere, so this comparison covers the part that decides budgets: cost structure. Both sell flat subscriptions for interactive coding. They split hard on programmatic use. Codex automation bills against the same flat ChatGPT plan windows, by OpenAI’s design. Claude Code automation meters against a monthly Agent SDK credit and then moves to per-token API billing, and Anthropic prohibits third-party services from running on subscription credentials at all.
What each subscription includes
Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu, and Enterprise plans, and OpenAI’s README recommends ChatGPT sign-in (github.com/openai/codex). Capacity arrives as usage windows: as planning estimates, Plus at $20 absorbs roughly $700 of API-equivalent work a month, Pro 5x at $100 roughly $3,500, Pro 20x at $200 roughly $14,000. Estimates, never guarantees; OpenAI publishes and adjusts the actual limits on its pricing page.
Claude Code is included with Claude Pro ($20) and Max plans ($100 for 5x, $200 for 20x), also delivered as usage windows for interactive sessions. Since June 2026, those plans additionally carry a metered Agent SDK credit, sized to the tier: $20 a month on Pro, $100 on Max 5x, $200 on Max 20x, covering personal programmatic use such as claude -p and the Agent SDK in your own projects.
That last sentence contains the structural split. On the OpenAI side, programmatic use draws from the same windows as interactive use. On the Anthropic side, programmatic use is a separate, metered allowance.
The programmatic-use policy table
| Question | Codex (OpenAI) | Claude Code (Anthropic) |
|---|---|---|
| Documented non-interactive mode | codex exec, for scripts and CI (developers.openai.com/codex) | claude -p, for personal use against the Agent SDK credit |
| Plan-backed automation | Draws on plan windows | Draws on the metered credit, then API billing |
| Headless sign-in | Device-code flow, documented | Subscription OAuth restricted to Anthropic’s own apps |
| Third-party harnesses on plan login | Sign in with ChatGPT exists; account rules apply | Not permitted on subscription credentials |
| Hosted services on plan credentials | Not specifically addressed; OpenAI has the final call | Expressly prohibited; enforced January 2026 against OpenCode and others |
| Overflow when limits hit | API key, per token | API key, per token |
Anthropic’s docs state it does not permit third-party developers to offer Claude.ai login or route requests through Free, Pro, or Max plan credentials on behalf of their users (code.claude.com/docs/en/legal-and-compliance). The June 2026 credits restored personal programmatic use; the hosted-service shape stayed banned. The full history, including the January 2026 enforcement, is in why we don’t support Claude Code.
The math at three usage shapes
Interactive only. A developer in the terminal all day fits either vendor’s flat plan. Costs are comparable at each tier and the deciding factors are model preference and how generous each vendor’s windows feel for your usage, which both vendors tune over time.
Personal automation, $1,000 a month of API-equivalent volume. On the Codex side, that volume fits inside a Pro 5x window estimate at $100 flat, or $229 all-in through a managed endpoint. On the Claude side, a Max 5x plan contributes its $100 credit and the remaining roughly $900 bills at Anthropic’s published API rates (anthropic.com/pricing), so total cost tracks volume. Windows absorb volume; credits meter it. That one sentence is the comparison.
Team or hosted automation. On the Codex side, plan-backed automation through third-party harnesses uses documented sign-in flows under OpenAI’s account rules: intended functionality, with OpenAI keeping the final call. On the Claude side, this shape is prohibited on subscription credentials regardless of volume, so the price is the API price. For a team burning $3,500 of monthly volume, that is roughly $229 all-in versus roughly $3,500, with the caveat that the Codex figure is a capacity estimate, not a guarantee.
The migration sentiment
The cost-structure gap shows up in community sentiment. As one heavy user put it in a developer forum: “I get way more out of the codex $100 plan than I was getting out of the Anthropic $200.” That is one data point about perceived capacity per dollar, not a benchmark, and window generosity shifts as vendors retune limits.
The fair framing: Anthropic chose to sell programmatic Claude through the API and meter the subscription path. OpenAI chose to include programmatic Codex inside plan windows. Neither is an accident; they are different answers to the same business question, and the buyer’s job is to price their own workload under each answer. The Plus-tier version of that arithmetic is in ChatGPT Plus vs the API for coding.
Both on the API
Strip the subscriptions away and the structures converge: both vendors meter per token. GPT-5 lists at $1.25 per million input tokens and $10 per million output as of June 2026 (openai.com/api/pricing); Anthropic publishes its per-model rates at anthropic.com/pricing. On a meter, agent-style coding workloads bill every plan step, tool call, and retry, so costs scale with loop count on either vendor. The API is the right lane for spiky workloads and for anything a subscription’s terms exclude.
What this means if you automate
If your coding automation runs on Claude, your costs are the credit plus the meter, by Anthropic’s design, and the details of that system are in Anthropic’s Agent SDK credits, explained. If it runs on OpenAI models, plan windows can carry the bulk of it: Codex Hosted runs OpenAI’s official Codex CLI signed into your own ChatGPT account, $129 a month with no inference markup, complete responses on the Codex lane, and your API key as overflow.
The calculator prices your current metered spend against the subscription-backed structure in about thirty seconds.
Frequently asked questions
Is Codex cheaper than Claude Code?
For interactive coding, both are flat subscriptions at comparable price points and the answer depends on how each vendor tunes its usage windows. The structural difference is programmatic use: Codex automation draws on ChatGPT plan windows, while Claude Code automation meters against a monthly Agent SDK credit and then moves to API billing. Heavy automation therefore tends to cost less on the Codex side.
Can Claude Code run on a subscription programmatically?
Only for personal use, and only within a metered allowance. Since June 2026, Anthropic includes Agent SDK credits with consumer plans ($20 on Pro, $100 on Max 5x, $200 on Max 20x) covering things like claude -p in your own projects. Third-party services routing requests through Free, Pro, or Max credentials remain prohibited by Anthropic's policy.
Can third-party tools use a ChatGPT plan for Codex?
OpenAI ships the building blocks: Codex is included in ChatGPT plans, codex exec is documented for scripts and CI, and device-code sign-in is documented for headless machines. Third-party harnesses use these flows under OpenAI's normal account rules, which prohibit sharing accounts. That is intended functionality, but OpenAI has the final call over its services.
What are Anthropic's Agent SDK credits?
A metered monthly allowance Anthropic added to consumer Claude plans in June 2026: $20 of credit on Pro, $100 on Max 5x, and $200 on Max 20x. The credits cover personal programmatic use such as the Agent SDK and claude -p. They do not change the ban on third-party or hosted services using subscription credentials.