Last verified: 6 August 2026; OpenAI, Anthropic and repo facts re-verified 11 August 2026.
Claude Sonnet 5 costs $2 per million input tokens and $10 per million output tokens — as standard pricing now, not an introductory rate. It wasn't supposed to stay that way: the launch price was labelled introductory through 31 August, with a 50% rise to $3/$15 scheduled for 1 September. Anthropic cancelled it. Their pricing page now says it outright: "The $2/$10 per million input/output token pricing for Claude Sonnet 5, announced at launch as introductory pricing through August 31, 2026, is now the standard price. The previously scheduled increase to $3/$15 per million input/output tokens on September 1, 2026 will not occur." If you'd budgeted a September jump into a long agentic coding job, take it back out.
That reversal is the reason this page exists this week. The broader question underneath it is one a lot of people are asking now that opencodex can point Codex CLI or Claude Code at a completely different vendor's model: if the harness is portable, what does each engine actually cost per token?
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.12.0, published 10 August 2026. About 9,300 stars on GitHub when I checked on 11 August.
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, SpaceXAI (still branded xAI throughout its docs and opencodex's config), 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 6 August 2026
Every price below came from the vendor's own pricing or docs page on the check date. Rates are per million tokens (MTok).
| Model | Input / MTok | Output / MTok | Source |
|---|---|---|---|
| Claude Sonnet 5 (standard — Sept rise cancelled) | $2.00 | $10.00 | platform.claude.com |
| Claude Opus 5 | $5.00 | $25.00 | platform.claude.com |
| Claude Haiku 4.5 | $1.00 | $5.00 | platform.claude.com |
| gpt-5.6-sol (≤272k input tokens) | $5.00 | $30.00 | developers.openai.com |
| gpt-5.6-sol (>272k input tokens) | $10.00 | $45.00 | developers.openai.com |
| gpt-5.6-terra (≤272k input tokens) | $2.00 | $12.00 | developers.openai.com |
| gpt-5.6-terra (>272k input tokens) | $4.00 | $18.00 | developers.openai.com |
| gpt-5.6-luna (≤272k input tokens) | $0.20 | $1.20 | developers.openai.com |
| gpt-5.6-luna (>272k input tokens) | $0.40 | $1.80 | developers.openai.com |
| Gemini 3.1 Pro Preview (≤200k input tokens) | $2.00 | $12.00 | ai.google.dev |
| Gemini 3.1 Pro Preview (>200k input tokens) | $4.00 | $18.00 | ai.google.dev |
| Gemini 3.6 Flash | $1.50 | $7.50 | ai.google.dev |
| Gemini 3.5 Flash-Lite | $0.30 | $2.50 | ai.google.dev |
| Grok 4.5 (<200k input tokens) | $2.00 | $6.00 | docs.x.ai |
| Grok 4.5 (≥200k input tokens) | $4.00 | $12.00 | docs.x.ai |
| deepseek-v4-pro | $0.435 (cache miss) / $0.003625 (cache hit) | $0.87 | api-docs.deepseek.com |
| deepseek-v4-flash | $0.14 (cache miss) / $0.0028 (cache hit) | $0.28 | api-docs.deepseek.com |
| Ollama, local inference | $0 | $0 | ollama.com |
The spread between the top and bottom of that table is enormous. gpt-5.6-sol output is $30/MTok. deepseek-v4-flash output is $0.28/MTok. That's a factor of over a hundred for the same slot in your Codex config.
The context cliff is the number that should scare you
Three of the four big providers in this table price 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.
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 $5/$30 to $10/$45 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 is the odd one out: Claude's published per-token table has no context-length threshold at all, so it's the only pricing in this comparison where the number you budget is the number you pay regardless of prompt size. OpenAI's 272k line is more forgiving than Google's and SpaceXAI'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. Not a promotional rate, not a trial credit. 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 not free, and it would be dishonest to leave that fuzzy. Ollama's own pricing page lists a free tier at $0 for unlimited public models run on your own hardware, then Pro at $20/mo or $200/yr for "50x more cloud usage than Free" and three concurrent cloud models. Max is $100/mo for ten concurrent cloud models and five times Pro's usage, and it's currently paused for new signups, so you can't buy it today even if you want it. Team is $25/seat/mo with a five-seat minimum.
DeepSeek: publish the flat rate, and one warning
DeepSeek's live pricing page shows a single flat rate per model. deepseek-v4-pro is $0.435/MTok for a cache miss on input, $0.003625/MTok on a cache hit, $0.87/MTok output. deepseek-v4-flash is $0.14, $0.0028, and $0.28 respectively. The cache-hit price is the interesting one for agentic work, where the same system prompt and the same file contents get resent turn after turn.
One line from that same page is worth quoting exactly, because it's the only forward-looking pricing statement DeepSeek makes there: "We plan to raise the overall pricing for DeepSeek API services in the near future, with a significant increase expected." No date, no figures. Treat today's rate as provisional.
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 gestures at Start, Build and Scale usage tiers but does not print the actual requests-per-minute or tokens-per-minute figures on that page, and I'm not going to guess at them. Same story for OpenAI, Google and SpaceXAI as reached through a proxy. 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.
The README's "40+ built-in providers" claim I could not confirm. The enumerated list in the README names roughly twenty by name; 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.
Star counts drift fast enough to be useless as a quality signal. The repo read roughly 7,760 earlier that week, 7,770 on 6 August and 9,298 on 11 August. Cite it if you must, but date it.
And the thing nobody says out loud: 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.12.0 shipped on 10 August 2026. You pay each provider directly.
Will Claude Sonnet 5 get more expensive?
No — not on the schedule everyone had in their calendar. The planned 1 September 2026 rise to $3/$15 was cancelled in August 2026; Anthropic's pricing page states the $2/$10 launch price "is now the standard price" and that the increase "will not occur."
Which model is cheapest for running Claude Code?
Local Ollama at $0 per token, if your hardware can handle the model. Among hosted APIs, deepseek-v4-flash at $0.14 in / $0.28 out is the lowest here, with gpt-5.6-luna at $0.20/$1.20 close behind (for prompts up to 272k input tokens — $0.40/$1.80 past it).
A warning that applies well beyond this table: 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 are 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.
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.
Top comments (0)