Would the cheap model really have been cheaper? cost-cliff replays your own Claude Code and Codex sessions against other models' price tables. It includes the prompt-length tiers that list prices hide: the Haiku 5.5 line at 100K tokens and the GPT-6 line at 272K.
Also a Claude Code skill.
cost-cliffis part of agent-preflight, 16 offline checks for coding agents:/plugin marketplace add thinx-pro/agent-preflightthen/plugin install cost-cliff@agent-preflight, and ask Claude in plain words.
The screenshot shows the bundled synthetic demo: three agent sessions whose context grows a few K tokens per turn and gets compacted. Run cost-cliff on your own logs to get your own numbers.
Claude Haiku 5.5 costs $0.10 / $0.50 per million tokens, but only for prompts up to 100,000 tokens. A longer prompt is billed entirely at $0.50 / $2.50, five times as much (Anthropic pricing). GPT-6 Luna and Sol do the same thing above 272K (OpenAI pricing). Agent sessions resend their whole context every turn, so a long session spends most of its turns over 100K.
When Haiku 5.5 launched, a widely discussed r/ClaudeAI comparison found the same task cost 12.7Γ more on Haiku 5.5 than on GPT-6 Luna, The prompt wasn't published, but commenters agreed the 100K tier was the main reason. You can't tell from a price page which model is cheaper for your work. Your logs can tell you, because they record every request's prompt size and cache split.
npx github:thinx-pro/cost-cliffThis reads ~/.claude/projects and ~/.codex/sessions for the last 30 days and prints a report. Nothing leaves your machine.
npx github:thinx-pro/cost-cliff --since all --html report.html # all history + HTML reportcost-cliff 0.1.0 470 requests Β· 3 sessions Β· 2026-10-01 β 2026-10-01
sources: Claude Code 470 Β· prices as of 2026-10-08
Prompt size per request p50 108K Β· p90 175K Β· max 215K
0β50K βββββ 44 9%
50β100K ββββββββββββββββββββ 167 36%
100β200K ββββββββββββββββββββββββββββββ 248 53%
200β272K β 11 2%
272Kβ500K 0 0%
500K+ 0 0%
Same trajectory, replayed on
model est. cost requests over cliff cliff premium
Opus 5.5 $35.95 no tier β
Sonnet 5.5 $17.97 no tier β
Haiku 5.5 $4.04 259 (55%) >100K $2.89 (72% of bill)
GPT-6 Sol $19.87 0 >272K β
GPT-6 Luna $0.993 0 >272K β
Actual list-price cost of what ran: $17.97 over 470 requests
β Haiku 5.5: 55% of your requests are over its 100K line, and that is 72% of its bill.
(This output is from the synthetic demo in demo/. To reproduce it, clone the repo and run node bin/cost-cliff.js demo --since all. scripts/make-demo.js regenerates the demo sessions.)
- Prompt-size histogram of every request, colored by which tier lines it crosses.
- Replay table: the same requests priced on each model, how many cross that model's tier line, and the cliff premium, meaning the extra you'd pay because those requests went over the line.
- Actual cost of what ran, at list price for the model that actually served each request. This includes Opus fast mode and the 1.1Γ US-only inference multiplier when the log records them.
--jsonfor scripts and--htmlfor a self-contained report you can share.
--since <30d|12h|YYYY-MM-DD|all> time window (default: 30d)
--source <claude|codex|all> which default log dirs to read
--project <text> only sessions whose project name contains text
--models <id,id,...> models to replay on (see --list-models)
--openai-ratio <n> GPT tokens per Claude token (default: 1, an assumption)
--no-sidechain ignore subagent (sidechain) requests
--prices <file> your own price table (same shape as prices.json)
--json / --html <file> machine-readable output / HTML report
You can also pass .jsonl files or directories as arguments, and cost-cliff detects the format of each file.
- Parse. For Claude Code, cost-cliff reads
assistantlines and theirusage. It dedupes on message id, because Claude Code writes one line per content block, and it treats each server-sideiterationas its own model call. For Codex, it readstoken_countevents (last_token_usage), dedupes repeated snapshots, and takes the model fromturn_context. - Size each request. Prompt size = uncached input + cache writes (5m and 1h) + cache reads. This is the number vendors use to pick a tier.
- Price it. For each target model, cost-cliff picks the tier from the prompt size and bills the whole request at that tier. It keeps the original cache split and uses each model's own cache-hit multiplier (0.05Γ on Opus/Sonnet 5.5, 0.1Γ elsewhere).
- Convert tokenizers when needed. Claude 4.7 and later produce about 30% more tokens than earlier Claude models (Anthropic's figure), and cost-cliff applies that. Vendors publish no ClaudeβGPT ratio, so the default is 1.0 and you can override it with
--openai-ratio.
All prices are in prices.json, with source links and a retrieval date. To use your own (for example, negotiated rates), pass --prices my.json.
- Same trajectory. A different model would write different output, take a different number of turns and compact at different times. The replay tells you what these requests would cost, not what a whole session on that model would cost.
- Context-window limits are not checked.
- Effort level isn't modeled separately. Thinking tokens are already counted in the logged output.
- List prices only: no batch, Flex, Priority, enterprise discounts or subscription plans. For subscription users, the "actual" number is what the same usage would cost on the API, not what you paid.
- OpenAI lists no cache-write price for
gpt-5.5, so those writes are billed at the input rate. GPT-5.6 Sol pricing is promotional. - The log formats are undocumented and could change. Please open an issue with a redacted line if parsing breaks.
--what-if-compact <N>: estimate savings from compacting before a tier line.- Per-session and per-project breakdowns, plus "which sessions would suit Haiku" hints.
- A price-table update command and more vendors (Gemini, DeepSeek).
- Read AUDR records.
MIT. Prices belong to their vendors and are reproduced for comparison. Check the linked pages before you make budget decisions.
