Learn

Codex CLI vs Claude Code CLI Cost: Plans, API and Cache

Compare Codex CLI and Claude Code by billing route, plan allowance, API and cache rates, and Fast mode, with two worked workloads showing how cache reuse drives the cost of a coding session.

UpdatedOctober 9, 2026

Short answer

What Codex CLI and Claude Code cost depends first on how you sign in and only second on the model. Signed in with a ChatGPT or Claude subscription, both CLIs draw from a shared plan allowance, and extra work is paid with credits. Signed in with an API key, every token is billed at API rates to the key's organization. Start with the subscription you already pay for; move to API billing when you need a separate project budget, attributable usage or unattended automation.

On this page6

On API prices, GPT-6.1 Sol and Claude Sonnet 5.5 are the low-cost workhorses at $2 input and $10 output per million tokens, and both read cache at $0.10 per million tokens. Claude Opus 5.5 costs twice that at $4/$20, and GPT-6 Astra and Claude Fable 5.1 are the premium tier at $10/$50. The worked examples below show that cache reuse, not headline rates, drives most of the bill in a long coding session.

All prices were checked on OpenAI's and Anthropic's official pricing pages on September 30, 2026. OpenAI API pricing, Claude API pricing, Codex pricing, Claude plans.

Identify the billing route

Record four things before a large job: the active login, the account or organization that pays, the included allowance left, and the model in use. Both CLIs show this with /status.

Route

What pays for the work

What to watch

Codex CLI with ChatGPT sign-in

The plan's shared ChatGPT Work and Codex allowance, then purchased credits on Plus and Pro, or workspace credits on flexible Business, Enterprise and Edu plans

Five-hour and weekly limits; Fast mode uses included usage 2.5x faster

Codex CLI with an OpenAI API key

API usage billed to the key's organization at API prices

No cloud features such as GitHub review; model access follows the key

Claude Code with a Claude subscription

The plan's shared Claude and Claude Code allowance, then usage credits at standard API rates if turned on

Five-hour window plus weekly limits; Fast mode draws only from usage credits

Claude Code with Console credentials or an API key

API usage billed to the Claude Console organization

An ANTHROPIC_API_KEY in the environment overrides a subscription login

Anthropic's guide warns that an ANTHROPIC_API_KEY takes precedence over a Pro or Max login, so a stray environment variable can move a session onto API billing. Codex with an API key likewise bills at API prices and cannot use cloud features. Claude subscription authentication, Codex authentication.

Model access also varies by route. On ChatGPT, Free and Go get GPT-6 Luna in the desktop app, Plus and Pro list GPT-6 Astra, GPT-6.1 Sol, GPT-6 Sol and Luna, with expanded access on Pro. On Claude subscriptions, Pro users pay for Fable 5.1 with usage credits, while Max can spend up to half of its weekly limits on Fable models. Fable plan access.

Compare current model and cache rates

The rates below are direct API prices in USD per million tokens at Standard speed. OpenAI's are its short-context rates, which apply up to 272,000 input tokens per request; longer requests cost more. Claude's cache writes use the five-minute cache. Claude Fable 5.1, Opus 5.5 and Sonnet 5.5 keep standard prices across their full 1M-token context window, while the Haiku 5.5 rates shown apply to prompts up to 100,000 tokens; longer prompts cost $0.50 input, $0.05 cache read, $0.625 cache write and $2.50 output.

Model

Uncached input

Cache read

Cache write

Output

GPT-6 Astra

$10

$1.00

$12.50

$50

GPT-6.1 Sol

$2

$0.10

$2.50

$10

GPT-6 Sol

$2

$0.20

$2.50

$10

GPT-6 Luna

$0.10

$0.01

$0.125

$0.50

Claude Fable 5.1

$10

$0.25

$12.50

$50

Claude Opus 5.5

$4

$0.20

$5

$20

Claude Sonnet 5.5

$2

$0.10

$2.50

$10

Claude Haiku 5.5

$0.10

$0.01

$0.125

$0.50

Two cache details stand out. GPT-6.1 Sol, released September 29, 2026, keeps GPT-6 Sol's $2/$10 rates but halves cache reads to $0.10. On the Claude side, Opus 5.5 and Sonnet 5.5 read cache at 5% of their input price (Sonnet 5.5 since Anthropic cut it from $0.20 to $0.10 on October 7, 2026) and Fable 5.1 at 2.5%, instead of the usual 10%, which is why Fable's $0.25 read rate sits far below Astra's $1.

For subscription users, Codex converts tokens into credits instead of dollars. GPT-6.1 Sol costs 50 credits per million input tokens, 2.5 per million cached and 250 per million output, GPT-6 Astra 250, 25 and 1,250, and GPT-6 Luna 2.5, 0.25 and 12.5. Codex credit billing has no separate cache-write charge.

Speed modes change these numbers. Claude Code's Fast mode runs Opus 5.5 up to 2.5 times faster at $8 input and $40 output per million tokens, twice its Standard rate, and cache multipliers apply on top. On subscriptions it is paid only from usage credits, and the first time you turn it on in a conversation, the whole existing context is charged at the Fast input rate. Codex's Fast mode uses included subscription usage at 2.5 times the Standard rate and purchased credits at 2 times. Claude Code Fast mode, Codex speed.

Two worked workload examples

Split each session into four token buckets: uncached input, cache reads, cache writes and output. Cost is each bucket in millions multiplied by its rate. OpenAI's reported input total includes cached tokens, so subtract them before pricing ordinary input; Claude reports cache reads and writes separately from input_tokens. Output includes reasoning tokens, so do not add thinking a second time. OpenAI prompt caching, Claude prompt caching.

Short interactive task

Assume a small explanation or patch uses 8,000 uncached input tokens and 2,000 output tokens, with no cache activity.

GPT-6 Astra costs 0.008 × $10 + 0.002 × $50 = $0.18, and Claude Fable 5.1 also costs $0.18. Claude Opus 5.5 costs $0.072. GPT-6.1 Sol, GPT-6 Sol and Claude Sonnet 5.5 each cost $0.036. Claude Haiku 5.5 and GPT-6 Luna each cost $0.0018. Haiku 5.5 uses Anthropic's newer tokenizer, which counts the same text as about 30% more tokens than Haiku 4.5, so token counts measured on Haiku 4.5 will read somewhat higher on Haiku 5.5. For quick tasks, a cheaper model is the sensible first try whenever it produces an accepted result without extra attempts.

Cache-heavy long session

Assume ten requests reuse a 100,000-token repository prefix: one 100,000-token cache write and nine reads totaling 900,000 tokens, plus 100,000 other uncached input tokens and 10,000 output tokens. Every request stays under 272,000 input tokens, and each reuse arrives before the cache expires.

Model

Uncached input

Reads

Write

Output

Session total

GPT-6 Astra

$1.000

$0.900

$1.250

$0.500

$3.650

GPT-6.1 Sol

$0.200

$0.090

$0.250

$0.100

$0.640

GPT-6 Sol

$0.200

$0.180

$0.250

$0.100

$0.730

GPT-6 Luna

$0.010

$0.009

$0.013

$0.005

$0.037

Claude Fable 5.1

$1.000

$0.225

$1.250

$0.500

$2.975

Claude Opus 5.5

$0.400

$0.180

$0.500

$0.200

$1.280

Claude Sonnet 5.5

$0.200

$0.090

$0.250

$0.100

$0.640

Claude Haiku 5.5

$0.050

$0.045

$0.063

$0.025

$0.183

For example, Fable 5.1 costs 0.1 × $10 + 0.9 × $0.25 + 0.1 × $12.50 + 0.01 × $50 = $2.975. It undercuts Astra by about 18% even though both list $10/$50, because its cache reads are a quarter of Astra's price. GPT-6.1 Sol and Sonnet 5.5 tie at $0.640 and beat GPT-6 Sol by 9 cents for the same reason. Each request here sends more than 100,000 input tokens, so Haiku 5.5 bills its long-prompt rates; with prompts under 100,000 tokens the same session would cost a fifth as much. The same session on Opus 5.5 in Fast mode would cost twice the Standard figure, about $2.56.

Long pauses that let the cache expire, changing prefixes, retries and tool output all move these totals. Treat them as budgeting examples, not predictions for your repository.

Common billing surprises

The most expensive mistakes are usually about routes, not rates. A leftover ANTHROPIC_API_KEY or OPENAI_API_KEY in a shell profile can send a long session to API billing while you believe the subscription is paying. Turning on Claude Code's Fast mode halfway through a long conversation charges the entire context at the Fast input rate once, so enable it at the start of a session or not at all.

Cache expiry is the second surprise. Claude's default cache lasts five minutes and refreshes each time it is read; after a longer pause the next request pays a fresh cache write. The one-hour cache costs twice the input price to write, which pays off only if you really do come back within the hour. OpenAI's caching behaves differently, so measure rather than assume. On OpenAI, a single request above 272,000 input tokens moves to long-context pricing, so very large repository dumps cost more per token than the table above shows.

The third surprise is the subscription pool itself. Codex usage is shared with ChatGPT Work, and Claude Code shares limits with Claude chat, so a heavy morning of chat can leave less room for an afternoon coding session. Check the usage dashboard or /status before starting a long unattended job.

When a subscription or API route fits

Use included access for interactive work when the model you want is available and your normal week fits the allowance. OpenAI estimates that Plus gets about 15 to 160 local GPT-6.1 Sol messages and 5 to 45 GPT-6 Astra messages every five hours; Pro plans at $100, $200 and $500 currently have no five-hour limit. Claude Pro costs $20 a month, or $17 billed annually, and includes Claude Code; Claude Max costs $100 for 5x or $200 for 20x Pro usage.

Use API billing when you need a separate budget for a project, usage you can attribute to a team, or automation in CI. For occasional work, paying per token can be cheaper than another subscription; for daily interactive work, an existing allowance usually wins. Claude's usage credits bill at standard API rates, so a subscriber who occasionally exceeds limits pays the same per-token price as an API user for that overflow. Claude usage credits.

A practical model policy is to run routine changes on GPT-6.1 Sol or Claude Sonnet 5.5, move repository-scale refactors to Claude Opus 5.5 or GPT-6 Astra, and reserve Fable 5.1 for the longest tasks. Escalate only when a stronger model measurably reduces failed attempts.

Before you switch

Run the same three tasks with each CLI: a routine fix, a debugging investigation and a longer refactor. Record the model, effort level, speed mode, token buckets, retries, elapsed time and review effort, and compare cost per accepted change rather than cost per answer.

After changing credentials, models or providers, run /status again to confirm the billing owner, then check remaining allowance, credit spending limits and cache duration. In Claude Code, the opus alias resolves to Opus 5.5, sonnet to Sonnet 5.5 and haiku to Haiku 5.5 (Claude Code v2.1.293 or later) on the Anthropic API, but aliases resolve to different models on some cloud providers. Claude Code model configuration.

Official sources

Editorial guidance grounded in official product sources.

Show all 34 sources

FAQ

Common questions

Will an API key use the subscription I already pay for?

No. Codex authenticated with an OpenAI API key charges the API account separately from ChatGPT. Claude Code using an Anthropic API key charges Console/API usage; Anthropic warns that ANTHROPIC_API_KEY can take precedence over subscription authentication. Claude Console browser login also uses API billing. Check the actual login method and organization before starting a large task.

Are Codex credits or Claude usage credits the same as an API balance?

No. Codex/ChatGPT credits pay for eligible usage under the ChatGPT billing arrangement. Claude usage credits fund eligible paid-plan work, including Claude Code, with Standard usage priced at API rates. Sharing a rate does not merge the balances: API credentials use the separate developer billing account. Check which balance you are topping up and its spending controls.

Can I use these Standard estimates for Fast or Pro?

No. Astra API Fast doubles applicable Standard rates; ChatGPT-authenticated Astra Fast uses 2.5 times Standard credits. Claude Code Fast uses premium Opus 5.5 pricing ($8/$40) and paid usage credits on subscriptions. Pro is separate: a Pro subscription is not the same as Pro reasoning. OpenAI's documented GPT-6 Pro reasoning bills additional aggregate model work at Standard token rates, so a Standard token-count example does not predict its total.

Why can't a $20 monthly plan promise a fixed number of tokens or coding tasks?

A subscription buys its specified access and allowance, rather than a prepaid quantity at the API rate. Model choice, shared usage, context, reasoning, tools and session limits change how much work fits. Neither these API examples nor a vendor's estimated message range guarantees monthly capacity. Watch your account's usage meter before upgrading or budgeting overflow.

Does the cheaper Fable 5.1 cache rate still help after a long pause?

Only if the request gets a cache hit. Claude's default cache lifetime is five minutes from the start of the latest write or read, so generation time counts too. A one-hour cache costs more to write and may fit slower interactions. OpenAI documents at least 30 minutes after write or reuse for GPT-6 and later. Recalculate using actual reads and writes instead of assuming every repeat is discounted.

Should I buy a plan just because Astra or Fable 5.1 appears in a price table?

Confirm model access first. Astra availability depends on rollout and workspace settings. Fable 5.1 requires Claude Code 2.1.255 or later and any organization permission; Pro and Standard seats use usage credits from the start, while qualifying Max/Premium allowances have a shared Fable limit. A published API price does not guarantee that your subscription includes the model.

Next steps

Take the next buying step