How LLM API pricing works: input, output and cached tokens

Last updated 2026-10-14 · by Prajyot Mulik

Try the tool: LLM Token Cost Calculator

Large language model APIs bill by the token, not by the request. Once you understand the handful of line items on that bill, you can estimate a feature’s running cost before you build it. This guide explains those line items using the pricing pages of Anthropic, OpenAI and Google as they stood on 14 October 2026, and ends with a worked example you can reproduce in the LLM Token Cost Calculator.

Tokens, and why they are not words

A token is the unit of text a model reads and writes. It can be a whole short word, part of a longer word, a space, or a piece of punctuation. Code, numbers and non-English text usually split into more tokens per character than English prose. A common rule of thumb for English is about four characters per token, which is what the calculator’s “estimate” option uses, but it is only a rule of thumb: for an exact number you need the tokenizer the provider actually uses.

Tokenizers differ between model families and even between versions. Anthropic’s pricing page notes that Claude 4.7 and later models use a newer tokenizer that produces roughly 30% more tokens for the same text than earlier models. The same prompt can therefore cost more on a newer model even at an identical price per token. Anthropic’s page also recommends counting tokens with its token-counting feature for the specific model you plan to use.

Prices are quoted per million tokens

All three providers quote list prices per 1,000,000 tokens (“MTok”). The arithmetic is the same everywhere:

cost = input tokens × input price ÷ 1,000,000 + output tokens × output price ÷ 1,000,000

Output tokens cost more than input tokens on every model in the calculator’s data. Anthropic’s Claude Sonnet 5.5, for instance, lists $2 per million input tokens and $10 per million output tokens; OpenAI’s GPT-6.1 Sol lists $2 and $10; Google’s Gemini 3.5 Flash-Lite lists $0.30 and $2.50. Two consequences follow. A feature that returns long answers is dominated by output cost, and a feature that sends large documents but returns short answers is dominated by input cost. Reasoning or “thinking” models bill their internal reasoning as output: Google’s pricing page labels its output price as “including thinking tokens”, so a short visible answer can hide a large billed output.

Cached input: write once, read cheaply

Many applications resend the same large prefix on every call: a long system prompt, a reference document, a tool list. Prompt caching lets the provider reuse its processing of that prefix, and the repeated part is billed at a much lower rate.

Anthropic publishes two prices on top of normal input. A cache write is billed at a premium over normal input (1.25× for a 5-minute cache, 2× for a 1-hour cache), and a cache read is billed at a fraction of normal input. The page states the read multiplier as 0.1× of the base input price, and lists lower figures for some models: 0.05× on Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025× on Claude Fable 5.1. OpenAI’s page has “cached input” and “cache writes” columns for its GPT-6 models, and Google lists a context-caching price (plus a separate storage charge for some models). Because writes cost extra, caching only saves money once the prefix has been reused enough times. The Prompt Caching Calculator computes that break-even point.

Modifiers that change the price

The headline price is a starting point. The pricing pages describe several modifiers, and you should check which ones apply to you:

  • Batch and flex processing. Anthropic’s Batch API gives a 50% discount on input and output tokens for asynchronous work; OpenAI and Google list batch and flex tiers too. They trade latency for price.
  • Long-prompt tiers. Anthropic prices Claude Haiku 5.5 higher for requests whose prompt is over 100,000 tokens, and says the count includes cache reads and writes. OpenAI’s page lists separate short-context and long-context prices. The calculator applies Haiku’s tier automatically, and uses OpenAI’s short-context rates only.
  • Regional or fast processing. Anthropic applies a 1.1× multiplier for US-only inference on newer models, and offers a premium “fast mode” for some models. OpenAI notes a 10% uplift for regional processing on models released on or after 5 March 2026. These are not in the calculator.
  • Tool charges. Server-side tools are billed separately. Anthropic lists web search at $10 per 1,000 searches plus the tokens involved, and OpenAI lists similar per-call charges for some tools.
  • Time-limited prices. Some listed prices change on a date. Google’s page shows Gemini 3.8 Flash at one price through 31 December 2026 and a higher price from 1 January 2027, which is one reason the calculator leaves out prices it cannot represent honestly.

A worked example

A support bot calls Claude Sonnet 5.5 about 1,000 times a day. Each call sends 2,000 input tokens and gets 500 back.

  • Input: 2,000 × $2 ÷ 1,000,000 = $0.004
  • Output: 500 × $10 ÷ 1,000,000 = $0.005
  • Per call: $0.009; per 1,000 calls: $9.00; per 30-day month at 1,000 calls a day: $270.00

Swap the model and the same traffic costs very different amounts: the same call on Claude Opus 5.5 ($4 and $20) is $0.018, or $540 a month; on GPT-6 Luna ($0.10 and $0.50) it is $0.00045, or $13.50 a month; on Gemini 3.5 Flash-Lite ($0.30 and $2.50) it is $0.00185, or $55.50 a month. Price is not quality, so run your own evaluation before choosing on cost alone.

Now add caching. If 1,500 of the 2,000 input tokens are an unchanging prefix reused within the 5-minute window, most calls pay the read price for those tokens instead of the full input price. The calculator shows the saving and how many reuses are needed to cover the cache-write premium. In the page’s worked example (a 20,000-token document reused for ten questions on Claude Sonnet 5.5) the cost falls from $0.44 to $0.108, a saving of about 75%.

How to estimate before you build

  1. Measure a realistic prompt with the provider’s token counter and write down input and output tokens per call.
  2. Multiply by calls per day and by 30. Add a margin for retries and growth.
  3. Decide which part of the prompt is reusable and test the caching break-even.
  4. Check rate limits: your plan may cap requests or tokens per minute before cost becomes the problem.
  5. Re-check prices before you commit a budget. They change, which is why every price on this site shows the date it was last checked.

Sources

All pages below were read on 14 October 2026.