Code Cost Calculator
Claude Code Cost Calculator FAQ
Short answers about token cost, local usage logs, and how Claude, Codex, and Cursor plan prices relate to an API-equivalent estimate.
How does this Claude Code cost calculator work?
It multiplies your token counts by the public per-million-token rates stored in this site. Uncached input, output, cache reads, and cache writes each have their own rate. The result is an API-equivalent dollar estimate. The math runs in your browser and nothing is sent to a server.
Do I need an Anthropic or OpenAI API key?
No. The calculator does not call Anthropic, OpenAI, or Cursor. It cannot see your account, and using it does not create an API charge.
Is my JSONL usage log uploaded?
No. The file is read with the browser File API. This site has no upload endpoint for logs. Closing the tab drops the file from the page.
Why are Claude Code input tokens so small?
In Claude's usage object, input_tokens is only the tail after the last cache breakpoint. The large prompt usually sits in cache_read_input_tokens and cache_creation_input_tokens. This calculator prices those fields separately. Treating cache reads as full-price input would overstate the cost.
How do I estimate cost from a Claude Code session file?
Claude Code writes one JSONL file per session under your Claude config directory, in projects, then a folder per working directory. Drag that file onto the calculator. When several lines share a message id and request id, the parser keeps the largest output-token count, because Claude Code repeats usage while a reply streams.
What if the log does not split 5-minute and 1-hour cache writes?
The flat cache_creation_input_tokens field is priced at the 5-minute write rate. Claude Code often uses the 1-hour cache, which costs more (2× input instead of 1.25×). If the nested cache_creation split is present, that split is used and the flat total is not added again.
Is Claude Pro, Max, or Ultra cheaper than the API?
The page compares API-equivalent cost with the monthly sticker. Those plans include Claude Code, but Anthropic does not publish a token quota. A five-hour or weekly limit can stop you before the API-equivalent cost reaches the sticker. Max and Ultra also include API credits that Anthropic says cannot be used in Claude Code. Those credits are not subtracted.
How is the Codex cost calculator priced?
Same token math, using OpenAI list rates. On Codex logs, cached input is treated as a subset of input tokens, which is the opposite of Claude's split. Cumulative token_count snapshots are not summed. The largest total in the file is used so a session is not counted once per event. ChatGPT Go, Plus, and Pro include Codex, but not as a published token allowance.
How is the Cursor cost calculator priced?
Composer and Grok use the rates Cursor publishes for usage beyond the weekly pool. Third-party models use API list price. The optional Cursor Token Rate is $0.25 per million tokens for Teams and Enterprise third-party requests. It does not apply to individual plans or to Cursor's own models, and it stays off until you enable it. Plus does not include third-party models.
Are these the official prices?
They are copied from public pricing pages and labeled with the date they were checked. Vendors change prices. Your contract, region, batch discount, or data-residency choice can differ. Confirm the source pages linked in the footer before you rely on a number.
What is left out of the estimate?
Taxes, discounts, credits you already bought, batch and flex tiers, and server-side tool fees such as web search. Fast mode and regional routing are included only when those toggles are on. The weekly included pool on Cursor is not modeled as a token balance, because it is not published as one.
How do I update the prices?
Edit lib/pricing.ts. Change the rates and the last-checked date, then run npm test. The calculator, pricing table, and plan comparison all read that file. There is no network fetch and no API key to configure.