Codex CLI token cost: per task and per month
Short answer: OpenAI Codex CLI burns about 50K input tokens (65% cached) and 3,500 output tokens per typical task, so one task costs $0.0722 on Grok 4.7. At 150 tasks a month that is $10.84; without caching the same task would cost $0.1210. Evidence: documented.
Cost per task, three price points
One row per scenario from our tool data. The three price columns price the identical token counts on the cheapest, mid and premium reference models, so the difference is the model rate, not the workload.
| Scenario | Input tokens | Cached input | Output tokens | Cheapest current model | Mid-tier reference model | Premium reference model |
|---|---|---|---|---|---|---|
| Light task one short request with a small context and one or two tool calls | 12K | 50% | 1,200 | $0.00126 | $0.0222 | $0.2520 |
| Typical task one coding or agent task with several tool calls and a medium context | 50K | 65% | 3,500 | $0.00382 | $0.0722 | $0.7650 |
| Heavy session a multi-turn agent session with a large repo or long history; input counts all tokens re-sent across turns | 200K | 75% | 10K | $0.0115 | $0.2350 | $2.30 |
Rates: input $2 / cached $0.5 / output $6 per 1M on Grok 4.7. Prices checked 2026-11-18.
Monthly budget
| Scenario at 150 tasks / month | Cheapest current model | Mid-tier reference model | Premium reference model |
|---|---|---|---|
| Light task | $0.1890 | $3.33 | $37.80 |
| Typical task | $0.5737 | $10.84 | $115 |
| Heavy session | $1.72 | $35.25 | $345 |
At 150 tasks a month, one task at the typical size costs $0.0722 on Grok 4.7, so $100 covers about 1384 tasks. The same budget buys 131 tasks on the premium reference and 26144 on the cheapest one.
Server-rendered from the typical task on Grok 4.7 at 150 tasks a month. Change a field to recalculate; nothing is sent anywhere and the formula is the one under Method.
Where the tokens go
- 50K input tokens, 65% of them cached. Codex sends the model file contents, command output and its own tool calls, so repo exploration and test output dominate input tokens. The CLI shows a context-remaining meter, and long sessions or subagents multiply the billed input; thinking tokens are billed as output. of the input is the tool's prompt, tool schema and history; the cached share is what the provider can reuse on the next step without re-reading it at the full rate.
- 3,500 output tokens — 14.3× fewer tokens than the input. The answer is short relative to the context the tool sends with it, which is the normal shape for an agent step.
- Output is 7% of the token count but 29% of the bill on Grok 4.7. Output is priced higher than input, so the visible answer still matters even when most tokens are input.
- Per 1,000 tasks: $72.25. That is the number to put in a budget line, not the per-token rate: 1,000 tasks at the typical size cost $72.25 on Grok 4.7 and $765 on GPT-6 Cyber.
- At 150 tasks a month: $10.84 on Grok 4.7 and $115 on GPT-6 Cyber. The premium reference is 10.6× the mid-tier bill; the cheapest reference is $0.5737.
The provider basis behind these numbers
OpenAI documents Codex token rates in ChatGPT credits (GPT-6.1 Sol: 50 credits input, 2.5 cached input, 250 output per million tokens) and publishes local-message ranges per five-hour window (15-160 messages for GPT-6.1 Sol on Plus), explicitly saying larger projects and long sessions consume significantly more per message. The tiers assume task prompts plus AGENTS.md, tool definitions and file reads land around 50k input tokens for a typical task, with 50-75% of that prefix served from cache on later turns.
What caching is worth here
Our data does not assume a cached prefix for this tool (65% cached share), so the task price above is already the uncached input price. If the tool does repeat a stable prefix, adding it to the provider cache cuts the input side to $0.5 per 1M on Grok 4.7.
How to reduce it
- Keep AGENTS.md short and task-specific instead of a repository manual.
- Run /status and check remaining context before long tasks; start a fresh session for unrelated work.
- Use gpt-6.1-sol or a smaller model for routine edits and reserve heavier models for hard reasoning.
- Ask for focused diffs and delegate broad research to a subagent so its file reads stay out of the main context.
Each tip changes a different part of the formula: caching changes the input rate, trimming history changes the input count, and routing simple steps to a cheaper model changes the rate for part of the work.
Sources and evidence
| Source | Read on | What it establishes |
|---|---|---|
| learn.chatgpt.com | 2026-11-04 | Codex/ChatGPT token credit rates, plan usage limits and local-message ranges per five-hour window. |
| learn.chatgpt.com | 2026-11-04 | Codex CLI surfaces (default model, /status context meter, subagents, MCP) that determine token consumption. |
Evidence label: Documented
OpenAI documents Codex token rates in ChatGPT credits (GPT-6.1 Sol: 50 credits input, 2.5 cached input, 250 output per million tokens) and publishes local-message ranges per five-hour window (15-160 messages for GPT-6.1 Sol on Plus), explicitly saying larger projects and long sessions consume significantly more per message. The tiers assume task prompts plus AGENTS.md, tool definitions and file reads land around 50k input tokens for a typical task, with 50-75% of that prefix served from cache on later turns.
Method
The formula
Cost per task = (uncached input × input rate + cached input × cached rate + output × output rate) ÷ 1,000,000. Rates are the standard list prices in the price table (checked 2026-11-18); token counts come from src/tools.json (tool data reviewed 2026-11-05).
Why three reference models
The columns are the cheapest, median and most expensive current models by the cost of one typical agent task, named above so you can check each rate. They are a range, not a prediction of which model OpenAI Codex CLI uses.
What the monthly figure assumes
150 tasks a month (the tasks-per-month field in our tool data), the same count for every scenario, at the standard rate with no batch discount. A heavy session can count as several tasks, so replace the number with your own before you put it in a budget.
Official links
Related skills & plugins
Other entries in the AI coding agents category. Each name links to its token-cost page or its official site.
- Claude Code — Anthropic's terminal coding agent for multi-step software tasks. ($0.0810 per task, Documented)
- Cursor — AI-first code editor and agent with per-token third-party model billing. ($0.0760 per task, Estimated)
- ChatGPT skills — Reusable skills that give ChatGPT and Codex new capabilities. (Resource)
- All skills, plugins and MCP token costs
Related models
The three reference models in the cost table, with their full price tiers.
- GPT-6 Luna — $0.1 input / $0.5 output per 1M tokens, $0.00382 per typical task in the table above
- Grok 4.7 — $2 input / $6 output per 1M tokens, $0.0722 per typical task in the table above
- GPT-6 Cyber — $20 input / $100 output per 1M tokens, $0.7650 per typical task in the table above
More
- Benchmark comparison: price vs performance
- Best LLM for coding in 2026
- Find a model for your use case
- Compare two to four models on price
Related
- All skills, plugins and MCP token costs
- Best LLM for coding in 2026
- Find a model for your use case
- Token cost calculator
- Compare two models on price
- Claude Code token cost
- Cursor token cost
Questions
How much does OpenAI Codex CLI cost per task?
One typical task costs $0.0722 on Grok 4.7, $0.00382 on the cheapest reference model (GPT-6 Luna) and $0.7650 on the premium reference (GPT-6 Cyber). The spread is the model rate: the token counts are identical in all three columns.
What does OpenAI Codex CLI cost per month at 150 tasks?
$10.84 a month on Grok 4.7 at the typical task size. Without the 65% cached input assumption it would be $18.15. Per 1,000 tasks the token bill is $72.25.
Why does OpenAI Codex CLI use so many input tokens?
Codex sends the model file contents, command output and its own tool calls, so repo exploration and test output dominate input tokens. The CLI shows a context-remaining meter, and long sessions or subagents multiply the billed input; thinking tokens are billed as output. The token shape is 50K input tokens (65% cached) against 3,500 output per typical task; input is resent every step, output is not.
Are the OpenAI Codex CLI token numbers measured or estimated?
The evidence label is "Documented". OpenAI documents Codex token rates in ChatGPT credits (GPT-6.1 Sol: 50 credits input, 2.5 cached input, 250 output per million tokens) and publishes local-message ranges per five-hour window (15-160 messages for GPT-6.1 Sol on Plus), explicitly saying larger projects and long sessions consume significantly more per message. The tiers assume task prompts plus AGENTS.md, tool definitions and file reads land around 50k input tokens for a typical task, with 50-75% of that prefix served from cache on later turns. Sources and read dates are in the table above; if a number is an estimate, the basis says what it assumes, and it is never described as a measurement.
Next step → See every tool cost side by side
Price data last checked 2026-11-18 against official sources · how we verify
Price-change alerts
One short email when a provider changes a price or a promo ends. No spam, unsubscribe any time.