Learn
Codex CLI vs Claude Code CLI Cost: Plans, API and Cache
Compare Codex CLI and Claude Code by billing route, included allowance, model rates and cache reuse. Two worked workloads show when lower token prices change the cost of a coding task.
Clarify the spend threshold before you commit. Use this page when the core product is familiar and the real question is whether to stay free, upgrade, or switch pricing tracks.
Editorial guide
Guide
Start with the spend threshold and the conditions that change the pricing decision.
Short answer
Start with the CLI whose included allowance covers your chosen model and actual workload. That can minimize additional spending if you already pay for the plan. For API-funded work, compare the model, cache behavior and completed result: neither Codex CLI nor Claude Code has one universal task price.
GPT-6 Astra and Claude Fable 5.1 have equal Standard input/output prices, but Fable 5.1 has cheaper cache reads. GPT-5.6 Sol, Terra, Claude Opus 5 and Sonnet 5 offer lower base rates. The calculations below show how those differences affect a short task and a session that repeatedly reads repository context. These are illustrative budgets, not hands-on test results. OpenAI API pricing, Claude API pricing.
Identify the billing route
Before comparing prices, record the active account, authentication method, workspace or API organization, included allowance, remaining credits and person responsible for the bill. A browser login alone does not prove subscription billing: Claude Code also supports browser-based Console authentication. Codex authentication, Claude Code authentication.
Route | What pays for the work | Billing owner to check |
|---|---|---|
Codex with ChatGPT sign-in | Eligible plan allowance, then purchased credits where supported; Work and Codex share usage | Personal subscriber or ChatGPT workspace |
Codex with an OpenAI API key | Separately metered API usage | The key's OpenAI API organization/project |
Claude Code with a Claude subscription | Shared Claude/Claude Code allowance for included models; usage credits for eligible extra usage | Personal subscriber or Claude organization |
Claude Code with Console credentials or an API key | Separately metered Claude API usage | Claude Console organization |
OpenAI distinguishes ChatGPT allowances from API-key pricing. Anthropic likewise separates subscription access from Console billing; its Pro/Max guide warns that an ANTHROPIC_API_KEY can take precedence over subscription login. Check the active route before running a large job. OpenAI billing routes, Claude subscription authentication.
Model entitlement is another boundary. Astra is rolling out to eligible accounts; its availability in your CLI must be confirmed even if you have Codex access. OpenAI says eligible Astra usage draws on existing subscription allowances or workspace billing. Astra availability.
Fable 5 and 5.1 together can use up to 50% of regular weekly allowance on Max and qualifying Premium seats. That is shared capacity, not an additional allowance for each model. Pro and Standard seats use paid usage credits for Fable from the start. Fable plan rules.
Compare current model and cache rates
The following are direct API prices in USD per one million tokens, using Standard processing and OpenAI's short-context tier. Claude write prices use its five-minute cache duration. They are not ChatGPT credit rates, subscription token entitlements or third-party cloud quotes. OpenAI rate card, Anthropic rate card.
Model | Uncached input | Cache read | Cache write | Output |
|---|---|---|---|---|
GPT-6 Astra | $10 | $1 | $12.50 | $50 |
GPT-5.6 Sol | $4 | $0.40 | $5 | $20 |
GPT-5.6 Terra | $2 | $0.20 | $2.50 | $12 |
Claude Fable 5.1 | $10 | $0.25 | $12.50 | $50 |
Claude Opus 5 | $5 | $0.50 | $6.25 | $25 |
Claude Sonnet 5 | $2 | $0.20 | $2.50 | $10 |
Sol's listed rates are promotional; recheck before a longer commitment. Sonnet 5's $2/$10 input/output rates are its Standard prices, following cancellation of the previously announced increase. OpenAI pricing notes, Claude pricing notes.
Context tier and session length are different. Astra requests above 272,000 input tokens charge twice the input/cache rates and 1.5 times the output rate for the full request: $20 uncached input, $2 reads, $25 writes and $75 output per million. Fable 5.1, Opus 5 and Sonnet 5 retain Standard API rates across their supported 1M context window; subscription context access can differ. Astra model pricing, Claude long-context pricing.
Cache lifetime also matters. OpenAI documents at least 30 minutes after a write or reuse for GPT-5.6 and later. Claude's default five-minute lifetime refreshes on use; its one-hour writes cost $20 for Fable 5.1, $10 for Opus 5 and $4 for Sonnet 5 per million tokens. A cheap read rate helps only when reuse succeeds. OpenAI caching, Claude caching.
Keep speed and reasoning modes separate. Astra API Fast is twice the applicable Standard rates, while ChatGPT-authenticated Astra Fast consumes 2.5 times Standard credits. Claude Code Fast is an Opus 5/4.8 research-preview configuration priced at $10 input/$50 output per million; subscription users fund it with usage credits rather than included limits. It is not Fable Fast. First enabling Claude Fast within a conversation also charges its existing context at the Fast uncached-input rate. OpenAI API pricing, Codex speed, Claude Code Fast.
A Pro subscription, Pro reasoning mode and Fast processing are different purchases or settings. OpenAI documents GPT-5.6 Pro reasoning as more aggregate model work billed at the selected model's Standard token rates. Astra Pro has no separately verified rate here; leave its estimate unresolved rather than infer a rate or token multiplier from Standard or Fast. OpenAI reasoning modes.
Two worked workload examples
Use four non-overlapping token buckets. With counts measured in millions, model cost is uncached input × input rate + cache reads × read rate + cache writes × write rate + billable output × output rate.
OpenAI's total input count includes reads and writes, so subtract both to obtain ordinary input. Claude's input_tokens already excludes its separately reported cache reads and writes. Charging cached tokens again as ordinary input overstates either bill. OpenAI usage accounting, Claude usage accounting.
Both examples assume Standard processing, no Pro mode, no regional surcharge or negotiated discount, and zero separately billed hosted-tool or external-service calls. Billable output includes generated reasoning/thinking; do not add it a second time or count only the visible answer. OpenAI reasoning billing, Claude thinking billing.
Short interactive task
Assume a small code explanation or patch uses 8,000 uncached input tokens, zero cache reads, zero cache writes and 2,000 billable output tokens. The no-cache assumption is deliberate; actual CLI sessions can write cache even on their first request.
Astra: 0.008 × $10 + 0 × $1 + 0 × $12.50 + 0.002 × $50 = $0.18. Fable 5.1 also totals $0.18. The same assumed counts cost $0.072 on Sol, $0.040 on Terra, $0.090 on Opus 5 and $0.036 on Sonnet 5. These totals use the Standard rate table above.
The frontier pair ties because this workload gets no cache-read discount. A cheaper model is the sensible first trial if it can produce an accepted result without additional attempts.
Cache-heavy long session
Assume ten requests reuse a 100,000-token repository prefix: one 100,000-token cache write followed by nine successful reads totaling 900,000 tokens. Across the session, add 100,000 uncached input tokens and 10,000 billable output tokens. Total input processed is 1,100,000 tokens, but assume every individual request stays below 150,000 input tokens, so Astra's long-context premium does not apply.
All Claude reuse requests begin within five minutes of the preceding write/read; OpenAI reuse also succeeds. The uncached bucket includes all remaining instructions, history and tool-result text. These are assumed aggregate meters, not predicted token counts for a particular repository.
Model | Uncached input cost | Read cost | Write cost | Output cost | Model total |
|---|---|---|---|---|---|
GPT-6 Astra | $1.000 | $0.900 | $1.250 | $0.500 | $3.650 |
GPT-5.6 Sol | $0.400 | $0.360 | $0.500 | $0.200 | $1.460 |
GPT-5.6 Terra | $0.200 | $0.180 | $0.250 | $0.120 | $0.750 |
Claude Fable 5.1 | $1.000 | $0.225 | $1.250 | $0.500 | $2.975 |
Claude Opus 5 | $0.500 | $0.450 | $0.625 | $0.250 | $1.825 |
Claude Sonnet 5 | $0.200 | $0.180 | $0.250 | $0.100 | $0.730 |
For example, Fable 5.1 is 0.1 × $10 + 0.9 × $0.25 + 0.1 × $12.50 + 0.01 × $50 = $2.975. Its $0.675 advantage over Astra comes entirely from cache reads under these assumptions. Neither model is guaranteed to use the same number of tokens to finish the same task.
Long pauses, changing prefixes, additional reasoning, retries and tool calls can change the totals. If a required rate or charge is unknown, report the known subtotal and leave the final total unresolved.
When a subscription or API route fits
Use included access first for interactive work when the model is available and your normal sessions fit the allowance. ChatGPT offers limited Codex access on Free/Go and larger paid allowances; Plus is $20 monthly. Claude Pro is $20 month to month or $200 billed annually and includes Claude Code, subject to shared limits. Compare the whole subscription's value rather than dividing its fee by an API token price. ChatGPT plans, Work/Codex pricing, Claude plans.
Choose API billing when you need a separate project budget, attributable usage or repeatable automation. For intermittent work, measured API spend may be lower than an additional subscription; for frequent interactive use, an existing allowance may be more economical. Compare your actual monthly task mix, including overflow. Claude usage credits can extend paid-plan work at Standard API rates, but remain a paid-plan billing route. Codex API access, Claude usage credits.
Try Terra or Sonnet 5 for routine changes, and retain Sol or Opus 5 if they already meet the acceptance bar. Escalate to Astra or Fable 5.1 when a difficult task justifies measuring whether stronger reasoning reduces failed attempts or review repair. OpenAI reports token-efficiency gains for Astra in selected evaluations; Anthropic positions Fable for its hardest, longest tasks. Those are vendor claims, not proof of your repository's cost per accepted change. OpenAI model guidance, Claude Code model guidance.
Before you switch
Run a small comparison on representative tasks: a routine fix, a debugging investigation and a longer refactor. Record the active model/version, effort and speed mode, token categories, extra charges, elapsed time, retries and human review effort. Judge cost per accepted change with passing tests, not cost per generated answer.
Confirm the account and billing owner again after changing credentials, models or providers. Check remaining allowance, credit spending controls, cache duration and per-request context size. Claude's fable alias resolves to Fable 5.1 from version 2.1.255 unless overridden; Fable is not the account-type default. Astra access remains subject to rollout and workspace settings. Claude Code configuration, Astra rollout.
Evidence boundary
Official sources
Editorial guidance grounded in official product sources.
- Claude Code by Anthropic | AI Coding Agent, Terminal, IDE
- Claude subscription plans and annual billing
- Overview - Claude Code Docs
- Claude official site
- Home | Claude Help Center
- Codex official site
- Codex Pricing
- ChatGPT | ChatGPT Learn
- GPT-6 Astra announcement and rollout
- OpenAI API pricing: Standard, Fast and cache categories
- Using GPT-6 Astra: model guidance
- ChatGPT plans and product access
- ChatGPT Work and Codex pricing and allowances
- Claude API pricing and context tiers
- Claude Fable models on your plan
- Claude Code model configuration
- Codex authentication and API billing
- Claude Code authentication and Console sign-in
- Use Claude Code with your Pro or Max plan
- GPT-6 Astra model specifications and pricing notes
- OpenAI prompt caching and usage accounting
- Claude prompt caching, duration and usage accounting
- Codex speed and Fast credit consumption
- Claude Code Fast mode pricing and billing
- OpenAI reasoning modes and billable output
- Claude thinking and output billing
- Manage usage credits for paid Claude plans
- Claude subscriptions and Console API billing are separate
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 pricing and paid usage credits on subscriptions. Pro is separate: a Pro subscription is not the same as Pro reasoning. OpenAI's documented GPT-5.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-5.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
Use these next pages to confirm the plan, tool, or alternate route that fits once the spend boundary is clear.