Running Codex CLI or Claude Code on Another Model: What It Actually Costs (2026)

Running Codex CLI or Claude Code on Another Model: What It Actually Costs (2026) — illustration

Last verified: 7 November 2026. The chart and the table below were both re-checked on that date; the chart shows a selection, the table has every row. Updated 7 November: added Claude Haiku 5.5 with its two prompt-length price bands and marked Haiku 4.5 as legacy, corrected the line saying Anthropic has no context-length pricing, moved GPT-5.6 Sol’s promo end date to 30 November 2026, updated Ollama’s plan wording, refreshed opencodex’s release and star count, and pointed the Gemini links at Google’s new pricing URL.

For real Claude Code or Codex CLI sessions, which often run past 100K tokens, the cheapest hosted engine in this table is deepseek-flash, at $0.15 per million input tokens and $0.60 output off-peak ($0.30/$1.20 at peak). Claude Haiku 5.5 is cheaper only for requests up to 100K tokens, at $0.10/$0.50, and jumps to $0.50/$2.50 above that. Claude Sonnet 5.5 is $2/$10, Claude Opus 5.5 is $4/$20, and local Ollama costs $0 per token because it runs on your own machine.

Anthropic’s current models are Fable 5.1, Opus 5.5, Sonnet 5.5 and Haiku 5.5; the table carries the last three. Its models page now files Sonnet 5, Opus 5 and Haiku 4.5 under “Legacy models (still available)”, and Opus 5.5 is cheaper than the Opus 5 it replaces. Anthropic’s own advice: “If you’re unsure which model to use, start with Claude Opus 5.5 for most workloads.” (The September price rise once scheduled for Sonnet 5 was cancelled, so it stays at $2/$10 too.)

opencodex is what makes the comparison worth doing. It can point Codex CLI or Claude Code at a completely different vendor’s model, so if the harness is portable, the per-token price of each engine is yours to pick.

Output cost per million tokens for models opencodex can route Codex CLI or Claude Code to, verified 7 November 2026 Horizontal bar chart, log base-10 scale from $0.50 to $25 per million tokens (MTok), of USD short-context output price for selected models from the table below, cheapest to most expensive. Claude Haiku 5.5 is not plotted; its output price is $0.50 for requests up to 100K tokens and $2.50 above, as shown in the table. deepseek-flash, served by DeepSeek-V4.1-Flash: $0.60 off-peak, rising to $1.20 during DeepSeek's weekday peak hours (01:00-04:00 and 06:00-10:00 UTC, Monday-Friday); the bar shows the off-peak price with an amber extension to the peak price. gpt-5.6-luna, prompts up to 272K input tokens: $1.20, rising to $1.80 above 272K. Gemini 3.5 Flash-Lite: $2.50. Claude Haiku 4.5 (legacy): $5.00. Grok 4.5, under 200K input tokens: $6.00. Claude Sonnet 5.5: $10.00, the current Sonnet-class flagship; Claude Sonnet 5, now listed as legacy by Anthropic but still available, is priced identically at $10.00 and is not shown as a separate bar. Gemini 3.1 Pro Preview, up to 200K input tokens: $12.00. gpt-5.6-terra, up to 272K input tokens: $12.00. Claude Opus 5.5: $20.00, Anthropic's current recommended default and cheaper than the legacy Opus 5. gpt-5.6-sol, up to 272K input tokens: $20.00, a promotional price stated by OpenAI to run until 30 November 2026. Claude Opus 5: $25.00, now listed as legacy by Anthropic but still available, and the most expensive bar in this chart. All prices verified 7 November 2026 against each vendor's own pricing or docs page. OUTPUT PRICE PER MTOK — VIA OPENCODEX Sonnet 5.5 $10, Opus 5.5 $20/MTok Log scale (base 10), $0.50–$25/MTok. Bar length shows ratio, not dollar gap. Verified 7 Nov 2026 · per vendor's own pricing/docs page $0.50 $1 Ollama (local) $0 /MTok — your own hardware deepseek-flash (V4.1-Flash) $0.60 /MTok off-peak, $1.20 peak gpt-5.6-luna $1.20 /MTok (≤272k tokens; $1.80 above) Gemini 3.5 Flash-Lite $2.50 /MTok Claude Haiku 4.5 (legacy) $5.00 /MTok Grok 4.5 $6.00 /MTok (<200k tokens) Claude Sonnet 5.5 $10.00 /MTok — Sonnet 5 (legacy) is the same price Gemini 3.1 Pro Preview $12.00 /MTok (≤200k tokens) gpt-5.6-terra $12.00 /MTok (≤272k tokens) Claude Opus 5.5 $20.00 /MTok — current default, cheaper than Opus 5 gpt-5.6-sol (promotional) $20.00 /MTok promo — until 30 Nov 2026 Claude Opus 5 (legacy) $25.00 /MTok — legacy, still available Current / off-peak price DeepSeek peak price (weekday UTC mornings) Log-base-10 scale from $0.50–$25/MTok so a 50x price spread stays readable. Equal bar-length gaps mean equal price ratios, not equal dollar gaps. Sources: platform.claude.com · developers.openai.com · aistudio.google.com · docs.x.ai api-docs.deepseek.com · ollama.com — verified 7 Nov 2026.
Short-context output price per million tokens (MTok) for a selection of the models opencodex can point Codex CLI or Claude Code at, cheapest to most expensive; Claude Haiku 5.5 ($0.50 output up to 100K tokens, $2.50 above), deepseek-v4-pro, Gemini 3.6 Flash and the long-context rows are in the table below. Claude Sonnet 5.5 and Claude Opus 5.5 are Anthropic's current flagships; the legacy Sonnet 5 and Opus 5 rows are marked as such — Sonnet 5 is the same price as 5.5 and not drawn as a separate bar, while Opus 5 at $25 is now the most expensive bar shown. The deepseek-flash bar shows its off-peak price with an amber extension to the weekday-peak price. gpt-5.6-sol's bar reflects its promotional price, stated to run until 30 November 2026. Log scale; verified 7 November 2026 against each vendor's own pricing or docs page.

What opencodex is, and what it isn’t

It’s a local proxy. Free, MIT-licensed, self-hosted, binds to 127.0.0.1 by default. Latest release is v2.98.0, published 7 November 2026. 18,280 stars on GitHub when I checked on 7 November.

It does not save you money on tokens. Every provider needs your own key or your own OAuth session. The README is direct about it: “Log in once, skip the API key — OAuth for xAI, Anthropic, and Kimi; or forward codex login, paste a key, or use ${ENV_VAR} references.” So opencodex doesn’t lower your bill. It changes which meter is running. That distinction is the whole point of the table below, because once you can freely swap the engine under Claude Code, the price per million tokens becomes a decision you make rather than one you inherit.

The provider list it ships with covers OpenAI (ChatGPT login or API key), Anthropic, Google Gemini, xAI (whose own docs now say “Available on the SpaceXSI API”; opencodex’s README and the API base URL still say xAI), Kimi, Azure OpenAI, and Ollama for local and cloud, plus DeepSeek, Groq, OpenRouter, Together, Fireworks, Cerebras, Mistral, Hugging Face, NVIDIA NIM, MiniMax, Qwen Cloud and SiliconFlow.

Per-token prices, verified 7 November 2026

Every price below came from the vendor’s own pricing or docs page on the check date. Rates are per million tokens (MTok). The OpenAI rows are GPT-5.6, which is now OpenAI’s previous generation; its flagships are GPT-6 Astra, GPT-6.1 Sol, GPT-6.1 Terra and GPT-6 Luna. The 5.6 family is still in the full model catalog and isn’t marked deprecated. GPT-6 pricing isn’t in this table because this update didn’t verify routing GPT-6 through opencodex; for GPT-6 per-token prices, see our OpenAI API pricing page.

ModelInput / MTokOutput / MTokSource
Claude Opus 5.5$4.00$20.00platform.claude.com
Claude Sonnet 5.5$2.00$10.00platform.claude.com
Claude Sonnet 5 (legacy, still available; Sept rise cancelled)$2.00$10.00platform.claude.com
Claude Opus 5 (legacy, still available)$5.00$25.00platform.claude.com
Claude Haiku 5.5 (prompts up to 100K tokens)$0.10$0.50platform.claude.com
Claude Haiku 5.5 (prompts over 100K tokens)$0.50$2.50platform.claude.com
Claude Haiku 4.5 (legacy, still available)$1.00$5.00platform.claude.com
gpt-5.6-sol (≤272k input tokens; promotional)$4.00$20.00developers.openai.com
gpt-5.6-sol (>272k input tokens; promotional)$8.00$30.00developers.openai.com
gpt-5.6-terra (≤272k input tokens)$2.00$12.00developers.openai.com
gpt-5.6-terra (>272k input tokens)$4.00$18.00developers.openai.com
gpt-5.6-luna (≤272k input tokens)$0.20$1.20developers.openai.com
gpt-5.6-luna (>272k input tokens)$0.40$1.80developers.openai.com
Gemini 3.1 Pro Preview (≤200k input tokens)$2.00$12.00aistudio.google.com
Gemini 3.1 Pro Preview (>200k input tokens)$4.00$18.00aistudio.google.com
Gemini 3.6 Flash (through 31 Dec 2026; $1.50/$7.50 from 1 Jan 2027)$0.75$3.75aistudio.google.com
Gemini 3.5 Flash-Lite$0.30$2.50aistudio.google.com
Grok 4.5 (<200k input tokens)$2.00$6.00docs.x.ai
Grok 4.5 (≥200k input tokens)$4.00$12.00docs.x.ai
deepseek-v4-pro (off-peak / peak)$0.66 / $1.32 (cache miss); $0.022 / $0.044 (cache hit)$1.98 / $3.96api-docs.deepseek.com
deepseek-flash, served by DeepSeek-V4.1-Flash (off-peak / peak)$0.15 / $0.30 (cache miss); $0.003 / $0.006 (cache hit)$0.60 / $1.20api-docs.deepseek.com
Ollama, local inference$0$0ollama.com

The spread between the top and bottom of that table is still enormous. gpt-5.6-sol output past 272k is $30/MTok. Claude Haiku 5.5 output under 100K tokens is $0.50/MTok. That’s a factor of sixty for the same slot in your Codex config.

Three rows carry a date you should put in your calendar. GPT-5.6 Sol’s price is promotional; OpenAI says it’s “available until November 30, 2026”, and neither the pricing page nor the model’s own page says what comes after. Gemini 3.6 Flash doubles on 1 January 2027. And DeepSeek now charges double during its weekday peak hours, covered below.

The context cliff is the number that should scare you

All four big providers in this table now price at least one model by prompt length. Gemini 3.1 Pro and Grok 4.5 put the threshold at 200k input tokens. OpenAI puts the GPT-5.6 family’s at 272k; the pricing table’s own header tooltips define short context as ≤272K input tokens and long context as everything above. Anthropic’s Haiku 5.5 switches at 100K, covered further down.

Gemini 3.1 Pro at or under 200k is $2 in, $12 out. Cross the line and it’s $4 in, $18 out. Input doubles; output goes up half again. Grok 4.5 is cleaner and worse: $2/$6 below 200k, $4/$12 at or above it — both sides double. OpenAI’s cliff has the same shape as Gemini’s: gpt-5.6-sol goes from $4/$20 to $8/$30 past 272k, input doubling and output up 1.5x, and Terra and Luna scale identically.

This is precisely the wrong failure mode for agentic coding, because agentic coding is a context-accumulation machine. Claude Code and Codex CLI don’t send you a tidy 4k-token prompt. They send file contents, tool call results, diffs, test output, and the entire prior conversation, on every turn. On a small repo you never notice. On a large one, the run starts comfortably under the threshold, grows through a dozen tool calls, and at some point a single extra file read pushes the prompt past 200k. From that turn onward you’re on the expensive rate, and nothing in your terminal announces it. You find out on the invoice.

Two practical consequences. If you’re routing Claude Code at Gemini 3.1 Pro, Grok 4.5 or the GPT-5.6 family through opencodex on a big codebase, budget for the upper tier, not the headline rate, because that’s where a real session ends up. And if you’re deliberately keeping context small — narrow file globs, fresh sessions per task, clearing history between subtasks — that discipline is now worth actual money rather than just speed. Our notes on keeping Claude Code’s context under control apply directly here.

Anthropic used to be the odd one out here, and mostly still is. Opus 5.5, Sonnet 5.5 and the legacy Claude rows in the table have no context-length threshold. Haiku 5.5, the new current Haiku, does. Anthropic’s pricing page says it “is priced by prompt length: a request whose prompt is over 100,000 tokens pays higher prices.” That’s $0.10/$0.50 up to 100K and $0.50/$2.50 above, five times the price on both sides, with the line at half of Gemini’s. If you route Claude Code at Haiku 5.5 on a real repo, budget for the upper band. OpenAI’s 272k line is more forgiving than Google’s and xAI’s 200k — an agentic session gets another 72k tokens of headroom before the meter jumps — but it’s the same trap.

Ollama is the only honest $0

Local Ollama inference costs nothing per token, because you already bought the hardware, and the marginal cost of a token is your electricity bill. For a router like opencodex that’s genuinely useful: point the cheap, high-volume work at a local model and reserve the metered API for the parts that need it.

The cloud tier is a different matter: it isn’t free. Ollama rewrote its pricing page since I last checked, and it’s now built around usage credits. The free tier is now headed “Pay as you go”, and its bullets are “Run models locally”, “No subscription”, “3 concurrent requests” and “No service fees”. Pro is $20/mo or $200/yr with “$60 of usage credits per month”, “Access to larger pro models” and “Fast mode (coming soon)”. Max is $100/mo with “$300 of usage credits per month” and “10 concurrent requests”. Team, marked early access, is $500/mo flat for unlimited users, with “$1,000 of usage credits per month, shared across the team”.

DeepSeek: the clock matters

DeepSeek’s pricing page splits every price into off-peak and peak, and peak is exactly double: “Peak hours are 01:00 - 04:00 and 06:00 - 10:00 UTC, Monday through Friday, excluding Chinese public holidays. All other hours are off-peak.”

deepseek-v4-pro is $0.66/MTok off-peak for a cache miss on input ($1.32 peak), $0.022 on a cache hit ($0.044 peak), and $1.98 output ($3.96 peak). The flash slot is a different story, and it’s not a rename. The page says: “Use deepseek-flash as the model name. The legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are still accepted, but the corresponding models have been retired, their requests are served by the DeepSeek-V4.1-Flash-1017 model and billed at the Flash price.” So an old opencodex config pointing at deepseek-v4-flash won’t error. It’ll quietly run a different model than the one you tested, which is the same silent substitution xAI pulled with its Grok slugs (more on that below). Old and new names are billed at the same Flash price: $0.15 / $0.30 for a cache miss, $0.003 / $0.006 on a cache hit, and $0.60 / $1.20 output, off-peak then peak.

If you’re in Europe, that morning UTC window is your working morning. Schedule the long unattended runs for the evening and the bill halves. The cache-hit price is still the interesting one for agentic work, where the same system prompt and the same file contents get resent turn after turn.

The only forward-looking line on the page now is generic: “Product prices may vary and DeepSeek reserves the right to adjust them.”

What the docs don’t tell you

Both major pricing pages moved, and stale links are everywhere. Anthropic’s per-token table now lives at platform.claude.com, not the old docs.anthropic.com console path. OpenAI’s is at developers.openai.com/api/docs/pricing; the platform.openai.com pricing path is superseded. If a blog post is quoting one of those old URLs, you have no idea how old its numbers are.

Rate limits are the gap. Anthropic’s pricing page mentions Start, Build and Scale usage tiers but doesn’t print requests-per-minute or tokens-per-minute figures; those live in its separate rate-limits doc. I checked the OpenAI, Google and xAI pricing pages cited in the table too, and none of them prints RPM or TPM numbers either. If you’re planning a high-throughput job, pull each vendor’s rate-limit doc directly rather than trusting a number in an article, including this one. There’s more on which providers are actually generous in our free AI APIs roundup and on Anthropic’s own tiering in is the Claude API free.

opencodex’s README now says it plainly: “40+ providers out of the box”. The list underneath names a couple of dozen and ends with “and more”; getting to forty would mean reading ocx init’s live provider list, which I didn’t do. Take the count as marketing until someone checks it.

Old model slugs are a quiet trap. xAI retired grok-4-1-fast-reasoning and grok-4-1-fast-non-reasoning on 15 May 2026, and requests to those slugs are now served by grok-4.3 and billed at grok-4.3’s $1.25/$2.50 per million. The name still resolves. Nothing in your terminal tells you the substitution happened. If you’re routing through a proxy to a model slug you picked months ago, check it against the vendor’s live model list before you check your invoice.

Star counts drift fast enough to be useless as a quality signal. The repo read 7,762 on 2 August, 7,770 on 6 August, 9,298 on 11 August, 16,851 on 3 October and 18,280 on 7 November. Cite it if you must, but date it.

Last point: swapping the model under Claude Code changes the model’s behaviour, not just the price. A cheaper engine that needs three attempts at a refactor isn’t cheaper. If you’re weighing the two harnesses themselves rather than the engines, we covered that in Claude Code vs Codex CLI.

FAQ

Is opencodex free? Yes. It’s MIT-licensed, self-hosted, and runs locally on 127.0.0.1 by default. v2.98.0 shipped on 7 November 2026. You pay each provider directly.

How much do Claude Sonnet 5.5 and Opus 5.5 cost per million tokens? Sonnet 5.5 is $2 input and $10 output. Opus 5.5 is $4 input and $20 output, cheaper than the legacy Opus 5 at $5/$25.

Which model is cheapest for running Claude Code? Local Ollama at $0 per token, if your hardware can handle the model. Of the hosted models in this table, Claude Haiku 5.5 is cheapest for requests up to 100K tokens, at $0.10 in / $0.50 out, but it jumps to $0.50/$2.50 above that. For long agent sessions over 100K tokens, deepseek-flash is cheaper: $0.15 in / $0.60 out off-peak, $0.30/$1.20 in DeepSeek’s weekday peak hours. It runs on DeepSeek-V4.1-Flash; the old deepseek-v4-flash model is retired, and that name now redirects to V4.1-Flash. gpt-5.6-luna is $0.20/$1.20 for prompts up to 272k input tokens, $0.40/$1.80 past it.

What happens above 200k tokens on Gemini or Grok? Gemini 3.1 Pro goes from $2/$12 to $4/$18. Grok 4.5 goes from $2/$6 to $4/$12. Long agentic sessions on large repos routinely cross that line.

Does opencodex reduce my token bill? No. It’s a routing layer. It lets you choose a cheaper meter; it doesn’t discount any of them.

Frequently Asked Questions

How much do Claude Sonnet 5.5 and Opus 5.5 cost per million tokens?

Claude Sonnet 5.5 is $2 per million input tokens and $10 per million output tokens. Claude Opus 5.5 is $4 input and $20 output, cheaper than the legacy Opus 5 at $5/$25.

Does opencodex cost anything to use?

No. opencodex is free and MIT-licensed, self-hosted, and binds to 127.0.0.1 by default. You supply your own API key or OAuth login for every provider it routes to, so you pay the underlying vendor's per-token rate, not opencodex.

What's the cheapest model you can route Claude Code to?

Local Ollama is $0 per token because inference runs on your own hardware. Of the hosted models in this table, Claude Haiku 5.5 is cheapest for requests up to 100K tokens, at $0.10 per million input and $0.50 output, but it rises to $0.50/$2.50 above 100K. For long agent sessions over 100K tokens, deepseek-flash is cheaper: $0.15/$0.60 off-peak and $0.30/$1.20 in DeepSeek's weekday peak hours. It's served by DeepSeek-V4.1-Flash; the old deepseek-v4-flash name still works but now runs V4.1-Flash. gpt-5.6-luna is $0.20/$1.20 for prompts up to 272K input tokens ($0.40/$1.80 above that).

Written by Hirak Banerjee

Indie dev and maker. I build AI-powered apps and write about the tools I actually use. Follow on X · GitHub

Get told when these numbers change

Every figure here is re-checked against the vendor's own docs. Leave your email and we'll tell you when one moves — only when something actually changes.

Join builders who ship faster. No spam.

Comments