[{"data":1,"prerenderedAt":49},["ShallowReactive",2],{"blog-claude-code-token-costs":3,"blog-related-claude-code-token-costs":33},{"slug":4,"title":5,"description":6,"category":7,"categoryId":8,"keyword":9,"date":10,"minutes":11,"body":12,"html":13,"headings":14},"claude-code-token-costs","What your Claude Code usage would cost at API prices","How to estimate Claude Code's cost at API prices: where the token counts come from, the four token types, why cache reads dominate, and how to cut the bill.","Usage & limits","usage-limits","claude code token costs","2026-11-17",5,"If you pay a flat Claude subscription, you never see a bill for Claude Code, but you can still estimate what the same usage would cost on the API. It tells you how heavy a user you are, whether a plan beats pay-per-token for you, and which habits cost the most. The estimate needs two things: your token counts, split by type and model, and the current API price list. Claude Code already computes a figure for you; this article explains what it means and where it misleads.\n\n## Where do the token numbers come from?\n\nThree places, from simplest to most flexible.\n\n**`\u002Fusage` in a session.** The Session block lists usage by model in four columns: input, output, cache read and cache write, with a dollar figure computed locally at list price:\n\n```text\nUsage by model:\n   \u003Cmodel>:  1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55)\n```\n\n(Illustrative numbers.) Per the docs, the figure is an estimate from token counts, and subscribers should not treat it as billing, since their usage is included in the plan. Totals reset when `\u002Fclear` starts a new session.\n\n**The status line.** Claude Code can show cost and context usage continuously if you configure the status line.\n\n**The transcripts.** Every session is a JSONL file under `~\u002F.claude\u002Fprojects\u002F`. Assistant entries carry a `usage` object with the same four counters (`input_tokens`, `output_tokens`, `cache_creation_input_tokens`, `cache_read_input_tokens`) and the model that answered. Summing them over a day gives your total. Two cautions if you script it: one API request can appear on more than one line, so de-duplicate by request ID rather than adding every line, and subagent work is logged too, so decide whether you want it included.\n\nFor a plain read of one day you can also use a plugin that does this for you. Relais ships one (see the end).\n\n## What are the four token types, and why do cache reads dominate?\n\n| Type | What it is | Price relative to input |\n| --- | --- | --- |\n| Input | New tokens sent that were not cached | Base price |\n| Cache write | Tokens stored in the prompt cache | Higher than base |\n| Cache read | Tokens served from the prompt cache | Much lower than base |\n| Output | Everything Claude generates, including thinking | Several times the base |\n\nCheck the exact ratios on Anthropic's API pricing page; they differ by model and change.\n\nHere is why this matters. Claude Code re-sends the whole conversation with every request. Thanks to prompt caching, the unchanged beginning is read from the cache at the cheap rate, so cache read is by far the biggest counter in a long session, typically orders of magnitude larger than fresh input. Cache read is cheap per token but enormous in volume, so it is still a sizable share of the estimated cost. Output is the opposite: few tokens, expensive ones.\n\nThe rule of thumb that falls out: cost grows with how long the conversation is multiplied by how many requests you make in it. A hundred tool calls in a huge context are far more costly than a hundred in a small one.\n\n## How do I compute an estimate?\n\nPull four totals per model, multiply by that model's four prices per million tokens, add:\n\n```text\ncost = (input        x P_input\n      + cache_write  x P_cache_write\n      + cache_read   x P_cache_read\n      + output       x P_output) \u002F 1,000,000\n```\n\nDo it per model, since a day that mixes a heavy model for planning and a lighter one for edits has two different price lists. Use the model names recorded in the transcript, not the aliases you typed: an alias like `sonnet` points to different models over time.\n\nA few things the estimate leaves out, so read it as an order of magnitude:\n\n- Extra pricing tiers for some models or long contexts, and any data residency multiplier. Claude Code applies a multiplier for some regions; your own script will not.\n- Organization-specific rates. A company on a contract with discounts can configure `modelPricing` in managed settings so `\u002Fusage` reflects its rates.\n- Anything on a subscription that is not metered in dollars at all.\n\nFor real billing, use your Console cost page (API users) or, on Team and Enterprise, the spend report in your admin console.\n\n## What does this tell me about plan vs. API?\n\nCompare your estimated API-price total for a typical month with what you pay for your plan. If the estimate is far above the plan price, the subscription is carrying real value, and a switch to pay-per-token would hurt. If it is far below, you are a light user and a cheaper plan may do. Two caveats: usage is lumpy, so use a month, not a day; and a plan has limits while the API does not, so the comparison is only fair if you were not blocked. See [Claude Pro or Max for Claude Code](\u002Fblog\u002Fclaude-code-pro-vs-max) for how to decide, and [Claude Code usage limits](\u002Fblog\u002Fclaude-code-usage-limits) for the windows themselves.\n\n## How do I lower the number?\n\nThe biggest levers, roughly in order:\n\n1. **Shorter contexts.** `\u002Fclear` between tasks, `\u002Fcompact \u003Cfocus>` in long ones, small CLAUDE.md, delegate big reads. See [the context window](\u002Fblog\u002Fclaude-code-context-window).\n2. **The right model for the job.** Use a lighter model for routine edits and for subagents; reserve the heaviest for hard problems. `\u002Fmodel` switches mid-session.\n3. **Lower effort and thinking.** Thinking tokens are billed as output. `\u002Feffort` lowers it per session. Some models cannot turn thinking off, so use the effort levels.\n4. **Specific prompts.** \"Fix the null check in `parse()` in `utils.ts`\" avoids a codebase tour.\n5. **Plan first.** Catch the wrong direction before an implementation exists.\n6. **Careful automation.** Loops, scheduled tasks, agent teams and routines each send your full context on every run. Make them small and few.\n7. **Mind the cache.** Your first message after a break longer than the cache lifetime reprocesses the whole context. If you are leaving for a long break with a heavy session open, compact or clear first.\n\n`\u002Fusage` on a subscription plan also lists recommendations ranked by their share of your recent usage, which saves guessing.\n\n## In Relais\n\nRelais has two optional plugins for exactly this, both off by default and turned on in Settings › Plugins. Token burn shows the tokens each turn read and wrote and what they would cost at API prices: today in the status bar, with a page for every day and model. Session budget sets a budget per session at API prices, with a chip in its header, orange from 80%, and a notification once it goes past. Both are estimates in the same sense as above: you still pay your Claude plan, not the API. See [features](\u002Ffeatures#plugins).","\u003Cp>If you pay a flat Claude subscription, you never see a bill for Claude Code, but you can still estimate what the same usage would cost on the API. It tells you how heavy a user you are, whether a plan beats pay-per-token for you, and which habits cost the most. The estimate needs two things: your token counts, split by type and model, and the current API price list. Claude Code already computes a figure for you; this article explains what it means and where it misleads.\u003C\u002Fp>\n\u003Ch2 id=\"where-do-the-token-numbers-come-from\">\u003Ca class=\"anchor\" href=\"#where-do-the-token-numbers-come-from\" aria-label=\"Link to this section\">#\u003C\u002Fa>Where do the token numbers come from?\u003C\u002Fh2>\n\u003Cp>Three places, from simplest to most flexible.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>\u003Ccode>\u002Fusage\u003C\u002Fcode> in a session.\u003C\u002Fstrong> The Session block lists usage by model in four columns: input, output, cache read and cache write, with a dollar figure computed locally at list price:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>Usage by model:\n   &lt;model&gt;:  1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55)\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>(Illustrative numbers.) Per the docs, the figure is an estimate from token counts, and subscribers should not treat it as billing, since their usage is included in the plan. Totals reset when \u003Ccode>\u002Fclear\u003C\u002Fcode> starts a new session.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>The status line.\u003C\u002Fstrong> Claude Code can show cost and context usage continuously if you configure the status line.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>The transcripts.\u003C\u002Fstrong> Every session is a JSONL file under \u003Ccode>~\u002F.claude\u002Fprojects\u002F\u003C\u002Fcode>. Assistant entries carry a \u003Ccode>usage\u003C\u002Fcode> object with the same four counters (\u003Ccode>input_tokens\u003C\u002Fcode>, \u003Ccode>output_tokens\u003C\u002Fcode>, \u003Ccode>cache_creation_input_tokens\u003C\u002Fcode>, \u003Ccode>cache_read_input_tokens\u003C\u002Fcode>) and the model that answered. Summing them over a day gives your total. Two cautions if you script it: one API request can appear on more than one line, so de-duplicate by request ID rather than adding every line, and subagent work is logged too, so decide whether you want it included.\u003C\u002Fp>\n\u003Cp>For a plain read of one day you can also use a plugin that does this for you. Relais ships one (see the end).\u003C\u002Fp>\n\u003Ch2 id=\"what-are-the-four-token-types-and-why-do-cache-reads-dominate\">\u003Ca class=\"anchor\" href=\"#what-are-the-four-token-types-and-why-do-cache-reads-dominate\" aria-label=\"Link to this section\">#\u003C\u002Fa>What are the four token types, and why do cache reads dominate?\u003C\u002Fh2>\n\u003Cdiv class=\"table-wrap\">\u003Ctable>\u003Cthead>\u003Ctr>\u003Cth>Type\u003C\u002Fth>\u003Cth>What it is\u003C\u002Fth>\u003Cth>Price relative to input\u003C\u002Fth>\u003C\u002Ftr>\u003C\u002Fthead>\u003Ctbody>\u003Ctr>\u003Ctd>Input\u003C\u002Ftd>\u003Ctd>New tokens sent that were not cached\u003C\u002Ftd>\u003Ctd>Base price\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Cache write\u003C\u002Ftd>\u003Ctd>Tokens stored in the prompt cache\u003C\u002Ftd>\u003Ctd>Higher than base\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Cache read\u003C\u002Ftd>\u003Ctd>Tokens served from the prompt cache\u003C\u002Ftd>\u003Ctd>Much lower than base\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd>Output\u003C\u002Ftd>\u003Ctd>Everything Claude generates, including thinking\u003C\u002Ftd>\u003Ctd>Several times the base\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003C\u002Fdiv>\n\u003Cp>Check the exact ratios on Anthropic&#39;s API pricing page; they differ by model and change.\u003C\u002Fp>\n\u003Cp>Here is why this matters. Claude Code re-sends the whole conversation with every request. Thanks to prompt caching, the unchanged beginning is read from the cache at the cheap rate, so cache read is by far the biggest counter in a long session, typically orders of magnitude larger than fresh input. Cache read is cheap per token but enormous in volume, so it is still a sizable share of the estimated cost. Output is the opposite: few tokens, expensive ones.\u003C\u002Fp>\n\u003Cp>The rule of thumb that falls out: cost grows with how long the conversation is multiplied by how many requests you make in it. A hundred tool calls in a huge context are far more costly than a hundred in a small one.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-i-compute-an-estimate\">\u003Ca class=\"anchor\" href=\"#how-do-i-compute-an-estimate\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do I compute an estimate?\u003C\u002Fh2>\n\u003Cp>Pull four totals per model, multiply by that model&#39;s four prices per million tokens, add:\u003C\u002Fp>\n\u003Cpre class=\"code\" data-lang=\"text\">\u003Ccode>cost = (input        x P_input\n      + cache_write  x P_cache_write\n      + cache_read   x P_cache_read\n      + output       x P_output) \u002F 1,000,000\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Do it per model, since a day that mixes a heavy model for planning and a lighter one for edits has two different price lists. Use the model names recorded in the transcript, not the aliases you typed: an alias like \u003Ccode>sonnet\u003C\u002Fcode> points to different models over time.\u003C\u002Fp>\n\u003Cp>A few things the estimate leaves out, so read it as an order of magnitude:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Extra pricing tiers for some models or long contexts, and any data residency multiplier. Claude Code applies a multiplier for some regions; your own script will not.\u003C\u002Fli>\n\u003Cli>Organization-specific rates. A company on a contract with discounts can configure \u003Ccode>modelPricing\u003C\u002Fcode> in managed settings so \u003Ccode>\u002Fusage\u003C\u002Fcode> reflects its rates.\u003C\u002Fli>\n\u003Cli>Anything on a subscription that is not metered in dollars at all.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>For real billing, use your Console cost page (API users) or, on Team and Enterprise, the spend report in your admin console.\u003C\u002Fp>\n\u003Ch2 id=\"what-does-this-tell-me-about-plan-vs-api\">\u003Ca class=\"anchor\" href=\"#what-does-this-tell-me-about-plan-vs-api\" aria-label=\"Link to this section\">#\u003C\u002Fa>What does this tell me about plan vs. API?\u003C\u002Fh2>\n\u003Cp>Compare your estimated API-price total for a typical month with what you pay for your plan. If the estimate is far above the plan price, the subscription is carrying real value, and a switch to pay-per-token would hurt. If it is far below, you are a light user and a cheaper plan may do. Two caveats: usage is lumpy, so use a month, not a day; and a plan has limits while the API does not, so the comparison is only fair if you were not blocked. See \u003Ca href=\"\u002Fblog\u002Fclaude-code-pro-vs-max\">Claude Pro or Max for Claude Code\u003C\u002Fa> for how to decide, and \u003Ca href=\"\u002Fblog\u002Fclaude-code-usage-limits\">Claude Code usage limits\u003C\u002Fa> for the windows themselves.\u003C\u002Fp>\n\u003Ch2 id=\"how-do-i-lower-the-number\">\u003Ca class=\"anchor\" href=\"#how-do-i-lower-the-number\" aria-label=\"Link to this section\">#\u003C\u002Fa>How do I lower the number?\u003C\u002Fh2>\n\u003Cp>The biggest levers, roughly in order:\u003C\u002Fp>\n\u003Col>\n\u003Cli>\u003Cstrong>Shorter contexts.\u003C\u002Fstrong> \u003Ccode>\u002Fclear\u003C\u002Fcode> between tasks, \u003Ccode>\u002Fcompact &lt;focus&gt;\u003C\u002Fcode> in long ones, small CLAUDE.md, delegate big reads. See \u003Ca href=\"\u002Fblog\u002Fclaude-code-context-window\">the context window\u003C\u002Fa>.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The right model for the job.\u003C\u002Fstrong> Use a lighter model for routine edits and for subagents; reserve the heaviest for hard problems. \u003Ccode>\u002Fmodel\u003C\u002Fcode> switches mid-session.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Lower effort and thinking.\u003C\u002Fstrong> Thinking tokens are billed as output. \u003Ccode>\u002Feffort\u003C\u002Fcode> lowers it per session. Some models cannot turn thinking off, so use the effort levels.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Specific prompts.\u003C\u002Fstrong> &quot;Fix the null check in \u003Ccode>parse()\u003C\u002Fcode> in \u003Ccode>utils.ts\u003C\u002Fcode>&quot; avoids a codebase tour.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Plan first.\u003C\u002Fstrong> Catch the wrong direction before an implementation exists.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Careful automation.\u003C\u002Fstrong> Loops, scheduled tasks, agent teams and routines each send your full context on every run. Make them small and few.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Mind the cache.\u003C\u002Fstrong> Your first message after a break longer than the cache lifetime reprocesses the whole context. If you are leaving for a long break with a heavy session open, compact or clear first.\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cp>\u003Ccode>\u002Fusage\u003C\u002Fcode> on a subscription plan also lists recommendations ranked by their share of your recent usage, which saves guessing.\u003C\u002Fp>\n\u003Ch2 id=\"in-relais\">\u003Ca class=\"anchor\" href=\"#in-relais\" aria-label=\"Link to this section\">#\u003C\u002Fa>In Relais\u003C\u002Fh2>\n\u003Cp>Relais has two optional plugins for exactly this, both off by default and turned on in Settings › Plugins. Token burn shows the tokens each turn read and wrote and what they would cost at API prices: today in the status bar, with a page for every day and model. Session budget sets a budget per session at API prices, with a chip in its header, orange from 80%, and a notification once it goes past. Both are estimates in the same sense as above: you still pay your Claude plan, not the API. See \u003Ca href=\"\u002Ffeatures#plugins\">features\u003C\u002Fa>.\u003C\u002Fp>\n",[15,18,21,24,27,30],{"id":16,"text":17},"where-do-the-token-numbers-come-from","Where do the token numbers come from?",{"id":19,"text":20},"what-are-the-four-token-types-and-why-do-cache-reads-dominate","What are the four token types, and why do cache reads dominate?",{"id":22,"text":23},"how-do-i-compute-an-estimate","How do I compute an estimate?",{"id":25,"text":26},"what-does-this-tell-me-about-plan-vs-api","What does this tell me about plan vs. API?",{"id":28,"text":29},"how-do-i-lower-the-number","How do I lower the number?",{"id":31,"text":32},"in-relais","In Relais",[34,39,44],{"slug":35,"title":36,"description":37,"category":7,"categoryId":8,"keyword":38,"date":10,"minutes":11},"claude-code-usage-limits","Claude Code usage limits: the 5-hour window and weekly cap","How Claude Code's 5-hour window and weekly limit work, what makes you hit them, how to check usage, and what to do the moment Claude Code stops.","claude code usage limits",{"slug":40,"title":41,"description":42,"category":7,"categoryId":8,"keyword":43,"date":10,"minutes":11},"claude-code-context-window","Claude Code's context window: why it fills up and what to do","Why Claude Code's context window fills up, what loads before you type, and the commands (\u002Fcontext, \u002Fcompact, \u002Fclear) that stop you running out mid-task.","claude code context window",{"slug":45,"title":46,"description":47,"category":7,"categoryId":8,"keyword":48,"date":10,"minutes":11},"claude-code-pro-vs-max","Claude Pro or Max for Claude Code: which plan fits you?","Claude Pro or Max for Claude Code? How to decide from your own usage: how often you hit the limit, how many sessions you run, and what else you could do.","claude pro vs max claude code",1794931098788]