SSD Nodes Learn Hosting plans →
How to do am Matt ConnorBy Matt Connor · Updated 2026-08-29

Wetin be Claude tokens and how e dey cost moni?

Claude token na 3.5 characters but code dey consume am fast. Find out why one turn fit cost 80,000 tokens and why five idle minutes for Claude Code fit make your next bill jump 5x.

Wetin be tokens for inside Claude?

Token na di unit of text wey Claude dey read and write: e fit be small part of word, wey be like 3.5 English characters. Dis figure come from Anthropic own glossary, and e mean say one word fit pass one token once you count spaces and punctuation, so one thousand words of prose fit pass 1,300 tokens. Code dey heavy pass: braces, operators, underscores, and indentation dey split into more tokens per character pass English, and source file wey get few hundred lines fit reach several thousand tokens. If agent decide to read file wey get 2,000 lines, dat one na five-figure token cost before anybody even write one line of new code.

Two things about tokenizers dey confuse pipo. First, dem be model-specific. As of July 2026, Opus 4.7 and later, Sonnet 5, and Fable 5 dey use newer tokenizer wey dey produce roughly 30% more tokens for di same text pass earlier Claude models (di exact increase dey vary based on wetin dey inside), and dis one dey change any budget wey you don set for tokens even though price per token no increase. Second, tiktoken, di library wey every blog post dey recommend, na OpenAI tokenizer and e dey undercount Claude by roughly 15–20% for normal text, and e dey even worse for code. Di only way to get correct count na to use di count_tokens endpoint, wey we go explain for below.

Why your coding session costs wetin e dey cost

Every Claude bill, weda na API invoice or subscription limit, dey depend on one meter: tokens wey enter, tokens wey comot. The pricing page fit make am look simple: so so dollars per million input tokens, so so per million output. Wetin the page no tell you be say for agentic coding session, the input side of the meter dey run pass wetin you fit imagine, because the whole conversation dey re-sent for every single turn. I don sell metered infrastructure for fifteen years, and tokens na the first meter wey I don see wey most customers no fit explain wetin dey make am spin. This na the lesson for how to read the meter: wetin count as input and output for agentic session, why the resend loop dey expensive, why prompt caching dey change the calculation, and which levers dey truly move the number.

Everything na input: wetin the meter dey count for real

People dey think say na the code wey Claude write dem dey pay for. For agentic session, that one na small part of the bill. Input tokens, wey get cheaper rate but plenty volume, include:

  • The system prompt. Claude Code own instructions, plus your CLAUDE.md and memory files, wey dem dey load for start of session and e dey stay for every request wey follow.
  • Tool definitions. Every tool schema wey the agent fit call. Every MCP server wey you connect dey add to this fixed cost, although Claude Code now dey defer full MCP tool definitions by default, so na only tool names dey stay for context until you first use the tool, wey dey reduce but no dey comot the cost.
  • Every file wey the agent read. A Read of a source file dey put the whole thing for context, and e dey stay there.
  • Every tool result. Test runs, grep output, terminal spew, build logs, all of dem dey come back as input tokens. A failing test suite wey print 8,000 lines just bill you for small book.
  • The entire conversation so far, wey dem dey re-send for every turn. This one deserve im own section.

Why dem dey charge for message wey you don send before

Claude API no dey keep state. E no dey remember your session between requests, nothing dey remember am. So for turn 2, the client go send turn 1 plus di response wey e get, join am with your new message. For turn 50, e go resend turn 1 reach 49, every file wey you read, every tool result, every diff, plus turn 50. Di model go re-read di whole transcript every time, and every one of those re-read tokens na input wey dem go bill you for.

Di result: cost per turn dey grow roughly linearly as di session length dey increase, and total session cost dey grow roughly quadratically. One message wey cost half a cent for turn 3 fit cost twenty times dat amount for turn 60, even if na di same one-line question, because e dey carry sixty turns of load. Dis na di main reason why plenty "why my bill high so" tickets dey come, and e no be Claude problem; every LLM product wey dey feel like e get state na just stateless API wey get resend loop underneath.

Output: wetin you see, plus the thinking wey you no see

Output tokens na the expensive ones, five times the input rate across the current lineup ($5/$25 for Opus 4.8, $3/$15 for Sonnet 5, $1/$5 for Haiku 4.5, as of July 2026). Output include the text and code wey Claude generate, and thinking tokens: the internal reasoning wey the model do before e answer. Two facts dey important here. Thinking dey bill at output rates and e count against max_tokens, an API response wey dey die with stop_reason: "max_tokens" and a truncated answer often mean say thinking don finish the budget before the answer finish. And for current models, the reasoning summary fit no show at all; Opus 4.8, Sonnet 5, and Fable 5 dey omit am by default, but the thinking still happen and dem still bill am. Wetin you no see no mean say e free.

Claude Code dey enable extended thinking by default because e dey improve multi-step work well-well, and the default budget fit reach tens of thousands of tokens per request. For simpler tasks, you fit reduce am: lower the effort level with /effort or inside /model, or adjust the thinking settings for /config. That one na real way to control cost, no be superstition.

Prompt caching dey change the math

Prompt caching na im make the resend loop no dey empty person pocket. The API fit cache stable prefix for your prompt, system prompt, tool definitions, and conversation history, then serve am for next request with small change. As of July 2026, the multipliers na: cache write dey cost 1.25× the base input rate (2× for the 1-hour variant), and cache read dey cost 0.1×. Writes dey expensive; reads get 90% discount. Just one read don pay back the 5-minute write premium finish.

Claude Code dey manage caching for you, and if session dey healthy, almost all that big resend dey come from cache. But the default cache dey last for five minutes from the last time you use am. If you go drink coffee come back late, send message, the cache don expire, and the whole prefix go write again at 1.25× instead of read at 0.1×. For 150K-token session, that one cold turn dey cost pass dozen warm ones. This na the thing wey dey surprise people but you must sabi am: if you dey idle then resume, e fit cost pass continuous work, because any idle gap wey pass the TTL go turn your next turn from cheap read go expensive re-write. Do your work for one stretch; no dey send small-small message for one big session every ten minutes.

If you dey call the API from your own application on a VPS, you no go get all this one for free. The common mistake wey people dey do na to put timestamp or request ID inside system prompt. This one dey change the prefix bytes every request and e go silently disable caching. The sign be say usage.cache_read_input_tokens go dey zero even though the calls look like say dem be the same.

Di formula, wit one worked example

Make you no mind anybody wey just talk say "one session cost $X." Price for session dey vary well-well. Wetin dey constant na dis formula:

turn cost = (uncached input      x base input price)
          + (cache writes        x 1.25 x base input price)
          + (cache reads         x 0.10 x base input price)
          + (output incl. thinking x output price)

session cost = sum over all turns

Worked example for Claude Opus 4.8, wey as of July 2026 dey cost $5 per million input tokens and $25 per million output. Imagine one mid-session turn wey carry 80,000 tokens of accumulated context: 75,000 wey dem read from cache, 3,000 wey dem write newly, 2,000 fresh input wey no get cache, and 1,500 output tokens wey include thinking.

  • Cache reads: 75,000 × $0.50/M = $0.0375
  • Cache writes: 3,000 × $6.25/M = $0.019
  • Uncached input: 2,000 × $5/M = $0.010
  • Output: 1,500 × $25/M = $0.0375

E reach like $0.10 for the turn; fifty turns like dat go be around $5. Now, if dat same turn happen after the cache expire: the full 80,000 tokens go need re-write at $6.25/M, wey be $0.50 before output. Dat one be like five times the cost of the warm turn, even though the work na the same. Dat difference na the whole story of caching for one number. Dem four lines na the only honest way to compare vendors, because sticker rates dey ignore cache reads and thinking entirely. If you run dem over three real jobs, you go see where the Claude bill dey land pass or below the OpenAI one.

If na the billing unit itself you wan understand instead of just one turn, wetin one million tokens mean for pages, files, and dollars dey run the same arithmetic for one level up. For calibration instead of prediction: Anthropic publish figures for enterprise Claude Code deployments, as of July 2026, say e average about $13 per developer per active day, $150–250 per month, wit 90% of users dey stay under $30 per day. How much you go spend depend on the model wey you choose, how you manage your session, and the size of your codebase, and dat na why the levers wey dey below dey important.

How you go take see your own usage

For Claude Code, the command na /usage (/cost still dey work, e be alias). The Session block wey dey for top show token statistics and estimate of how much the current session don cost; for subscription plans, the same screen go show your plan-limit bars and breakdown wey show how skills, subagents, plugins, and individual MCP servers dey use your tokens. For correct billing for API accounts, the usage page for Claude Console na the final authority, the CLI figure na just estimate. /context go draw colored grid of wetin dey occupy the context window, system prompt, tools, MCP definitions, files, and history; this one na the fastest way to spot bloated CLAUDE.md or MCP server wey too dey talk; pass all if you want see the full breakdown for every item.

From the API, every response go tell you exactly wetin happen:

response = client.messages.create(model="claude-sonnet-5", max_tokens=2048,
                                  messages=messages)
u = response.usage
total_prompt = u.input_tokens + u.cache_creation_input_tokens + u.cache_read_input_tokens
print(f"uncached={u.input_tokens} written={u.cache_creation_input_tokens} "
      f"read={u.cache_read_input_tokens} output={u.output_tokens}")

Make you note say input_tokens na only the uncached remainder, the true prompt size na the sum of all the three input fields. Agent wey run for one hour wey show input_tokens: 4000 no be cheap; the other 200,000 tokens come from cache. To estimate before you send, use the token-counting endpoint; e free to call, e get im own rate limit, and e dey count with the tokenizer of any model wey you name (make you treat the result as close estimate; billing dey reflect the real request):

count = client.messages.count_tokens(model="claude-sonnet-5",
                                     messages=[{"role": "user", "content": big_file}])
print(count.input_tokens)

No ever tiktoken, because of the reason wey we talk up there.

Subscription plans versus pay-as-you-go

Di way wey dis guide take work na di same everywhere; na only how dem dey charge you dey different. If you use API key, Anthropic go bill you pay-as-you-go, per token, base on di rates wey dem publish, so every number wey you see up so na real money. Dat meter dey start quick pass how many pipo dey expect, sake of say no free tier dey to fall back on, na only small credit dem dey give when you sign up and some few endpoints wey no dey charge money, wey be wetin new API account dey get before you add card for file. For Claude subscription (Pro, Max, Team, Enterprise), Claude Code usage dey comot from di allowance wey your plan get: as of July 2026, dat one na rolling five-hour session window plus one weekly window, wey you dey share across models and with claude.ai chat, and di /usage dollar figure na just for information, e no be bill. If you finish di window, you go see "You've hit your session limit" or "You've hit your weekly limit" with time wey e go reset, and if you switch models with /model, e no go restore access, sake of say di windows dey shared across all models. Dem windows dey follow di account, no be di client wey you dey use, and dis one dey important if you still dey try know wetin dey run natively for Linux and which plan cover each surface. Which of di two windows you finish go decide how long you go wait and wetin you fit do for di meantime, so e good make you know your options when you hit a limit mid-task. Plans fit optionally enable usage credits, wey you go manage with /usage-credits, to buy usage pass di limit. I no go print di plan quotas sake of say dem dey change anyhow: dem be di numbers wey dey volatile pass for dis topic, so check claude.com/pricing and your own /usage bars instead. Di token mechanics still dey important even for subscription, if you waste session, you go burn your window exactly di same way you for burn dollars. For di subscription side, see which Claude plan fits your usage.

Di levers wey dey really work

  • Limit wetin di agent dey read. "Fix di validation bug for auth.py" dey read one file; "improve dis codebase" dey read forty. Make CLAUDE.md small, dem dey load am for every session, so keep am for wetin important, and move instructions wey concern specific workflow go skills wey go load only when you need dem.
  • Clear and compact. /clear between tasks wey no relate, old context dey get resend, and dem go bill you again, for every message wey follow. Inside one long task, /compact Focus on the failing tests and the diff dey summarize history come down and e dey keep you comot from di quadratic curve.
  • Use di correct model size. Sonnet fit handle most coding for $2/$10 per million tokens for introductory pricing as of July 2026 ($3/$15 sticker, compared to Opus wey be $5/$25), and Haiku wey be $1/$5 na di correct tool for mechanical subagent work like log triage. Fable 5 dey for di oda side for $10/$50, e double Opus for both sides of di meter, so e good make you know which jobs really deserve dat price before you leave am select for routine work. /model dey switch mid-session.
  • Pre-filter verbose output. One hook wey dey grep test run come down to failures before Claude see am fit turn 20,000 tokens of tool result go 300, and e dey do am for every future resend of dat turn.
  • Batch wetin no be interactive. For your own API pipelines, classification, bulk review, and nightly jobs, di Batches API dey run di same models for 50% off in exchange for asynchronous delivery.
  • Respect di cache clock. Work for continuous stints. One detached Claude Code session inside tmux on a VPS no dey cost anything while e idle, tokens only dey spend when one turn run, but na di warm cache you go lose if you leave am idle, and di next turn go pay for di re-write.

FAQ

How many tokens one coding session for Claude Code dey use?

No fixed number dey. One single turn for middle of session fit carry tens of thousands of prompt tokens once files and history don plenty. One working session fit reach millions, but most of dem dey come from cache wey cost ten times less than the base rate. To check am, Anthropic publish enterprise figures as of July 2026 wey show say e dey average around $13 per developer per active day, and 90% of users dey spend under $30. Run /usage inside your own session; five minutes of watching am go give you better idea pass any published average.

Thinking tokens dey cost money even if I no see dem?

Yes. Dem dey bill thinking tokens as output tokens, wey be the expensive rate, and e dey count against max_tokens. Current models dey bill dem even when the interface no show the reasoning summary. If one response cut short with stop_reason: "max_tokens" before the answer finish, e fit be say thinking don finish the budget. For Claude Code, reduce the effort level with /effort for tasks wey no need deep reasoning.

Why long Claude Code session dey cost more per message?

Because the API no dey keep state: every turn dey re-send the whole conversation, every file wey you read, tool result, and previous exchange, as billed input. So, turn 50 go carry turn 1 reach 49 as load. Prompt caching dey serve the repeated prefix at about one-tenth of the base input price, but the prefix dey grow, and any idle gap wey pass the cache TTL go make the next turn become full-price re-write. /compact dey shrink the history; /clear dey reset am.

How I go check my Claude token usage and cost?

For Claude Code, /usage dey show session token statistics, local cost estimate, and plan-limit bars for subscriptions (/cost na alias); /context dey show wetin dey fill the window. For official API billing, use the usage page for Claude Console. Inside your own code, read response.usage; if you add input_tokens, cache_creation_input_tokens, and cache_read_input_tokens together, you go get the true prompt size. Use the count_tokens endpoint to estimate ahead of time, no use tiktoken.