Skip to content
Engineering11 min read

How Your LLM API Bill Really Works: Token Math (2026)

Md Badsha
Platform Engineer
18 Oct 2026
On this page
How Your LLM API Bill Really Works: Token Math (2026)

TL;DR: Every LLM API bill has the same five line items: input tokens (what you send), output tokens (what the model writes, ~5–10x the input price), cache reads (repeated input, ~90–99% cheaper), cache writes (storing that input — usually 1.25x the input price, or hourly storage on Gemini), and reasoning tokens (billed at the output rate on every provider, no exceptions). On Claude Sonnet 5.5, one request with 1M input + 200K output and a warm cache costs $4.54 (≈৳559); the same request on GPT-6 Luna costs $0.23 (≈৳28.52). All prices checked 18 October 2026.

Open your provider's usage dashboard and you'll see the same anatomy everywhere: input, output, cached input, cache creation, sometimes "thinking." Most developers glance at the total and move on — but the line items are where the savings hide. A cache write that costs more than fresh input, reasoning tokens billed at output rates on a model with $50/M output, a long-context surcharge that doubles your input bill past 272K tokens: these are the details that turn a $40 month into a $400 month. This post walks through each line item, what it costs on ten current models, and the exact math.

The five line items, in one table#

Line-item list prices, checked 18 October 2026, USD per million tokens. Gemini charges cache storage per hour instead of a write fee.

ModelInputCache readCache writeOutput
Claude Sonnet 5.5$2.00$0.10$2.50 (5-min) / $4.00 (1-hr)$10.00
Claude Haiku 5.5$0.10 ≤100K / $0.50 >100K$0.01$0.125 (5-min)$0.50 ≤100K / $2.50 >100K
Claude Opus 5.5$4.00$0.20$5.00 (5-min) / $8.00 (1-hr)$20.00
GPT-6.1 Sol$2.00$0.10$2.50$10.00
GPT-6 Luna$0.10$0.01$0.125$0.50
GPT-6 Astra$10.00$1.00$12.50$50.00
Gemini 4 Argon*$2.00$0.10storage $0.50/1M/hr$10.00
Gemini 3.8 Flash†$0.75$0.075storage $0.50/1M/hr$3.75
DeepSeek V4.1 Flash (off-peak)$0.15$0.003$0.15$0.60
Meta Muse Wonder 1.0$4.00$0.20— (none published)$20.00

* Argon is introductory pricing until 30 November 2026; it doubles to $4/$20 on 1 December 2026. † Flash is Google's list price; it rises to $1.50/$7.50 on 1 January 2027.

Input tokens: what you send#

Input tokens are everything the model reads: your prompt, system instructions, tool definitions, conversation history, retrieved documents. This is the cheapest line item on most price lists — and the one people underestimate, because "cheap per token" meets "very many tokens" in agent loops.

Two pricing quirks live here. First, Haiku 5.5 has a two-tier input price: prompts up to 100K tokens bill at $0.10/M, but cross 100K and the whole prompt bills at $0.50/M — a 5x step at a single token boundary. If your prompt hovers near 100K, trimming it below the line is the highest-leverage edit you can make. Second, OpenAI's long-context surcharge: on Sol, Luna, and Astra, any request above 272K input tokens bills input and cache at 2x and output at 1.5x — for the entire request, not just the overflow. A 300K-token request on Sol doesn't cost a little more; its input line doubles from $2 to $4 per million.

Output tokens: what the model writes#

Output is the expensive side of every price list — typically 4–10x the input price. On Sonnet 5.5, output is exactly 5x input ($10 vs $2); on GPT-6 Astra it's 5x too ($50 vs $10); on DeepSeek off-peak it's 4x ($0.60 vs $0.15). The ratio is the point: every token the model generates costs several times what a token you sent costs, so verbosity is a billing decision. A model that writes a 2,000-word explanation when you asked for a one-line fix isn't being helpful — it's multiplying your output line.

Cache reads: the ~90% discount#

Cache reads are repeated input served from the provider's cache instead of being re-processed: your system prompt, your few-shot examples, the conversation prefix that doesn't change between turns. The discount is the single biggest lever on any bill — typically 90–99% off the input price. Sonnet 5.5 cache reads are $0.10/M versus $2.00/M fresh (Anthropic halved this from $0.20 on 7 October 2026); DeepSeek's off-peak cache reads are $0.003/M versus $0.15/M, a 98% discount.

The catch: the cache only helps if your requests actually repeat the prefix. Randomize your system prompt per request, prepend timestamps, or shuffle tool definitions, and every request is a cache miss — you pay full input price while believing you're "using caching." Stable prefixes are a prerequisite, not a bonus. The full mechanics, per provider, are in the three-provider caching comparison.

Cache writes: the line item that costs more than input#

Here's the part most people miss: storing tokens in the cache costs money too — and on Anthropic and OpenAI it costs more than fresh input. A 5-minute cache write on Sonnet 5.5 is $2.50/M versus $2.00/M for fresh input (1.25x); the 1-hour write is $4.00/M (2x). OpenAI's cache write is likewise 1.25x input. So a request that writes to cache and reads it back once is more expensive than the same request with no caching at all.

Caching pays on the second read. Take 900K tokens on Sonnet 5.5: writing them costs $2.25 versus $1.80 fresh (an extra $0.45), but each subsequent cache read costs $0.09 instead of $1.80 — saving $1.71 per read. The write pays for itself on the second read and everything after is nearly free. In short agent loops that hit the same context three, five, ten times, this is where bills collapse. In one-shot requests, skip the cache write.

Gemini does it differently: no write fee, but cache storage at $0.50 per million tokens per hour — you pay rent for as long as the entry lives. Short-lived entries are cheap; a cache you hold all day for occasional hits quietly accumulates.

Reasoning tokens: always billed at output rates#

Every provider bills thinking/reasoning tokens at the output rate — no exceptions. Anthropic counts thinking blocks as output, OpenAI counts (invisible) reasoning tokens as output, Google's docs state output prices include thinking tokens, DeepSeek counts reasoning_content against the output budget, and Meta prices Wonder's reasoning tokens the same as output.

This matters because reasoning is invisible in most tools: you see a short answer and don't see the 25K thinking tokens behind it. On a model with $50/M output (GPT-6 Astra), 20K hidden reasoning tokens cost $1.00 — more than many entire requests on cheaper models. If your harness runs high-effort reasoning by default on an expensive model, the reasoning line can exceed the visible answer's cost. The dial and its defaults are covered in the thinking-budgets guide.

Worked example: one request, three models#

The scenario: one request with 1M input tokens (900K served as cache reads, 100K fresh — the 900K was written to cache on an earlier request at the 5-minute rate) and 200K output tokens. USD per the table above; BDT at ৳123.20 per USD, checked 18 October 2026.

Line itemSonnet 5.5GPT-6 LunaDeepSeek V4.1 Flash (off-peak)
Fresh input: 0.1M0.1 × $2.00 = $0.200.1 × $0.10 = $0.010.1 × $0.15 = $0.015
Cache write: 0.9M0.9 × $2.50 = $2.250.9 × $0.125 = $0.11250.9 × $0.15 = $0.135
Cache read: 0.9M0.9 × $0.10 = $0.090.9 × $0.01 = $0.0090.9 × $0.003 = $0.0027
Output: 0.2M0.2 × $10.00 = $2.000.2 × $0.50 = $0.100.2 × $0.60 = $0.12
Total USD$4.54$0.2315 ≈ $0.23$0.2727 ≈ $0.27
Total BDT≈ ৳559≈ ৳28.52≈ ৳33.60

BDT arithmetic: $4.54 × 123.20 = ৳559.33; $0.2315 × 123.20 = ৳28.52; $0.2727 × 123.20 = ৳33.60.

Three things worth noticing. First, the same request costs 20x more on Sonnet 5.5 than on Luna — the price spread across models dwarfs every optimization trick, which is why the pricing statistics roundup starts with model choice. Second, DeepSeek loses to Luna here despite cheaper headline input: DeepSeek's cache write is 1x its input price ($0.135) while Luna's is $0.1125 — on cache-heavy workloads, the write fee decides. Third, on Sonnet 5.5 the cache write ($2.25) is the single biggest line item — bigger than output — which is exactly why caching only pays from the second read onward.

Stacked bar chart showing the cost composition of one request (1M input with 900K cache reads plus 200K output) on three models: Claude Sonnet 5.5 totals $4.54, GPT-6 Luna totals $0.23, and DeepSeek V4.1 Flash off-peak totals $0.27, broken into fresh input, cache write, cache read, and output segments

Fine print that changes the math#

  • DeepSeek peak pricing is 2x off-peak (weekdays 01:00–04:00 and 06:00–10:00 UTC) — run the same request in those windows and every line item above doubles.
  • Haiku 5.5's 100K tier boundary applies to the whole prompt: 99K tokens costs $0.0099, 101K costs $0.0505. Watch the boundary.
  • Gemini's unified context (1,048,576 tokens covering input + thinking + output together) means heavy reasoning shrinks your available input window — and thinking bills at output rates on top of it.
  • Batch APIs (where offered) typically discount input/output ~50% for non-urgent work — a separate lever from everything above.

The bill in one glance#

If your bill is high because of…The line item is…The fix is…
Long prompts, big contextInputShorter prompts; smaller retrieval windows
Verbose answersOutputConcise system instructions; lower reasoning effort
Repeated system prompts billed at full priceCache reads (missing)Stable prefixes; verify hits in the dashboard
Cache writes on one-shot requestsCache writeOnly cache what repeats; prefer 5-min over 1-hr TTL
Invisible thinking on expensive modelsReasoning tokensLower effort on routine tasks; cheaper model for drafts
One runaway jobEverythingPer-key spend caps

Whichever provider you use, the same discipline applies: pick the cheapest model that does the job (the spread is 20x, not 20%), keep prefixes stable so cache reads hit, and cap every key so one buggy agent can't burn the budget. The model catalog lists what's available through Tokens with per-model pricing, and the docs cover usage tracking.

LLM billing FAQ#

Why is output always more expensive than input? Generating tokens is the compute-heavy part — each output token requires a full forward pass, while input tokens are processed in parallel. Providers pass that cost asymmetry straight through, typically 4–10x.

Do I pay for cache writes even if the cache is never read? Yes. The write fee (or storage rent on Gemini) is charged when the entry is created, regardless of whether any later request hits it. Never cache one-shot prompts.

Are reasoning tokens really invisible? On most providers, yes — thinking blocks don't appear in the response but do appear in usage as output tokens. Check the usage dashboard's token breakdown, not the chat transcript, to see them.

Does prompt caching work the same on every provider? No. Minimum cacheable lengths, TTL options, write fees vs storage rent, and read discounts all differ — Anthropic needs 1,024 tokens minimum (2,048 for Opus), OpenAI caches automatically from 1,024, Gemini charges storage instead of a write fee. Details in the three-provider comparison.

How do I estimate my monthly bill before I start? Multiply expected monthly tokens per line item by the per-million rates above, add a margin for retries and reasoning, and convert at ~৳123 per dollar. Then set a spend cap at 80% of that number and let the cap — not your willpower — enforce it.

Line-item prices and behaviors checked 18 October 2026. Providers change pricing; each provider's pricing page is the authority.

Sources: Anthropic pricing (Sonnet 5.5 cache-read change) · Anthropic API pricing · Claude Haiku 5.5 launch and pricing · GPT-6.1 Sol release, benchmarks and pricing · OpenAI pricing guide (long-context surcharge) · Gemini 4 Argon launch pricing · Gemini 4 Argon pricing details · DeepSeek pricing (peak/off-peak) · Meta Muse Wonder 1.0 release · LLM API cost comparison (reasoning tokens) · USD/BDT rate

Was this page helpful?

Still stuck? Open a support ticket

Use the coding models you already know, through one API

One key for OpenAI- and Anthropic-compatible tools. Pay in BDT or USD, and keep the coding agent you already use.

Create an account

Follow us for more articles