Search topic
codex cli cost calculator
Practical outcome
The token math behind Codex CLI pricing — plus how to track what you really spend.
Quick answer
npx whoburnedmore --local to see your real Codex token mix and its API-equivalent cost by day and model.Codex CLI is OpenAI's terminal agent: you give it a task, and it reads files, runs commands and edits code on your machine. Since April 2, 2026, OpenAI prices Codex on API token usage for Plus, Pro, Business and new Enterprise plans, replacing the earlier per-message rate card. That makes the cost question easier: whichever way you pay, the driver is tokens by class and by model. This page covers the estimation math, worked examples at current prices, and where unexpected spend usually comes from. Prices were checked against OpenAI's docs on November 8, 2026.
How Codex CLI token pricing works
There are three ways to pay for Codex, and they meter the same work differently:
The estimation formula
Each turn re-sends the conversation so far, the files Codex has read and the tool output. Most of that repeated prefix is served from the prompt cache at a steep discount. New input is charged in full. Output, which includes the model's hidden reasoning tokens, is the most expensive class.
Reasoning tokens are billed as output
OpenAI's reasoning models think before they answer, and those reasoning tokens are billed at the output rate even though you never see them. Higher reasoning effort (the “More reasoning…” options under/model) usually means more output tokens per task. Codex already counts reasoning inside its output total, so a correct tracker prices it once as output and does not add it a second time.Worked example: one heavy week
Say a week of Codex CLI work moved 40M input tokens, 34M of them cache hits, plus 1.2M output tokens. Agentic sessions often have cache-hit rates this high. At November 2026 standard API prices:
- fresh input (44%)44%
- output incl. reasoning (44%)44%
- cached input (12%)12%
Two things stand out. First, model choice changes the bill by two orders of magnitude for identical work. Second, cached input is over 80% of the tokens but only 12% of the cost. That is why keeping one long session on a codebase can be cheaper per turn than starting fresh every time, until the context gets so large that each turn carries a big fresh tail.
Estimate your monthly Codex cost before running
- 1
Measure one representative task
Run a typical task, then check/statusfor the session's token usage, or look at that day in the whoburnedmore dashboard. A real measurement beats guessing file sizes. - 2
Split it into the three classes
Note fresh input, cached input and output separately. If you only have a total, assume the cache share is high for long sessions and low for one-shotcodex execruns. - 3
Price it at the model you will actually use
Multiply by the table above. Add headroom for long-context requests over 272K input tokens, which cost 2× on input and 1.5× on output. Fast mode costs 2× the standard rate. - 4
Compare to the plan you are on
If a month of API-equivalent cost is well below $20, the API key is cheaper. If it is far above, a ChatGPT plan's included allowance is the better deal. Just make sure the five-hour and weekly limits fit how you work.
Actually measuring what you spent
Estimates are for planning. Afterwards you want real numbers. whoburnedmore reads the rollout files Codex writes under ~/.codex/sessions and ~/.codex/archived_sessions (or $CODEX_HOME), and prices each model's input, cached input and output:
$ npx whoburnedmore --local Counting your token usage… Local dashboard: file:///Users/you/.config/whoburnedmore/dashboard.html Re-run `npx whoburnedmore --local` to refresh it. Nothing left your machine.
The dashboard shows estimated cost overall, by tool and by model, a daily chart for the last 60 days, and a token breakdown by class. Costs come from the public LiteLLM price dataset, refreshed daily. A brand-new model that is not in it yet shows tokens with a $0 estimate. Remember too that local logs only cover work that ran on this machine. Codex cloud tasks are not in them.
What /status and /usage cover
/status shows the current session's token usage. /usage shows account token activity (daily, weekly or cumulative) and lets you redeem an earned rate-limit reset if one is available. Your remaining plan limits and reset times live on the usage dashboard at chatgpt.com/codex/settings/usage. None of these turns tokens into dollars by model, and none of them sees your other coding agents.
Plan limits vs API rate limits
On ChatGPT plans, the practical ceiling is the allowance. On Plus, OpenAI quotes 15–160 local messages per five hours on GPT-6.1 Sol, with weekly limits on top, and the range depends on task size. When you hit it, you can wait for the reset shown on the usage dashboard, buy credits where offered, or run extra local work with an API key at standard rates. On an API key there is no five-hour window. You are limited by your organisation's per-minute rate limits and your spend.
Track Codex alongside your other tools
If you also run Claude Code, Gemini CLI or Copilot CLI, Codex is only one part of your AI coding spend. See Codex usage limits for the five-hour and weekly caps, and Codex credit billing for how tokens convert to credits once the allowance runs out.price gap, gpt-6-luna to gpt-6-astra
logs stay on your machine
Codex moved to token-based pricing
Codex CLI cost is predictable once you know your model mix and cache-hit rate. Run npx whoburnedmore --local after a heavy week to get the real breakdown, then pick the cheapest model that still does the job. 🔥
Sources checked November 8, 2026: OpenAI API pricing, Codex pricing and usage limits, Codex models, Codex CLI slash commands, OpenAI Help Center rate card note on the April 2, 2026 change.
Related guides
How to Check Codex CLI Usage and Token Cost
Codex shows the current limits; here's how to see your full token history and cost by day.
Codex Usage Limits: 5-Hour and Weekly Caps
Where to check Codex's 5-hour and weekly limits—and what local token history cannot tell you.
AI Coding Cost: Claude Code vs Codex vs Gemini
A real cost comparison of the big three — measured from your logs, not marketing.