← Writing

What an LLM Call Really Costs: Tokens, Reasoning, Caching and Tools

Published
Reading
17 min
Contents · 11 sections
  1. The six things you pay for
  2. The prices, November 2026
  3. How prompt caching works
  4. OpenAI: automatic, with a newer twist
  5. Anthropic: you say what to cache
  6. Why static content goes first
  7. Reading the usage object
  8. The formula
  9. A worked example: Lantern Bikes’ support bot
  10. A checklist for cutting the bill
  11. Key ideas

Same prompt, same small “nano” model, two settings. With reasoning effort set to "low", the call returned 1,384 output tokens and took 13.5 seconds. Of those tokens, 1,308 were reasoning: thinking the model did before it answered, which you never see. With effort set to "none", the same call returned 94 output tokens in 2.9 seconds.

That measurement comes from Making a Nano Model Do a Flagship’s Job, the sister post to this one. The answer the user saw was short either way. The bill was not. Reasoning tokens are billed as output tokens, so one setting multiplied the output of that call by almost 15.

That’s the theme of this post: the price list says “per million tokens”, but a real call has five or six separate meters running. Some you see in the response. Some you don’t. If you only look at the headline price, you’ll guess wrong by a factor of 3, 10 or 80.

I won’t explain what a token is here. What’s a Token, and Why AI Has Limits covers that. And the non-API costs of AI tools (review time, mistakes, seats nobody uses) are in The Hidden Costs of AI Tools. This post is the meter itself: what one API call charges you for, how to read it, and how to make it smaller.


The six things you pay for

An LLM call can charge you for up to six things.

  1. Input tokens. Everything you send: system prompt, instructions, tool definitions, retrieved documents, the conversation so far, the user’s message.
  2. Cached input tokens. Input the provider has seen recently, in exactly the same order, and kept ready. Reading it costs a small fraction of the normal input price.
  3. Cache writes. Storing a prefix in the cache the first time. On some models this costs more than normal input.
  4. Reasoning tokens. The hidden thinking a reasoning model does before it answers. Billed as output tokens, at the output price, even though you never see them.
  5. Visible output tokens. The answer you actually get back.
  6. Tool fees. Built-in tools like web search can carry a flat fee per use, plus tokens for whatever the tool brought back.

Two of these are invisible in the text you get back (reasoning and tool content). Two of them depend on the order you put things in your prompt (cache reads and writes). And output is usually priced at around 5 times input, so anything that adds output tokens, especially hidden ones, moves the bill fastest.

OpenAI’s reasoning guide states it plainly: reasoning tokens are not visible via the API, but they take space in the context window and are billed as output. Anthropic’s thinking docs say the same for Claude: the tokens Claude spends reasoning are billed as output tokens even when the thinking text isn’t returned. On Claude, the thinking you can see is a summary, and you’re charged for the full thinking, not the summary.


The prices, November 2026

Here are one small and one flagship model from each provider, from the official pricing pages at the time of writing (November 2026). Prices are dollars per million tokens, standard tier, for normal-length prompts.

Model Input Cache write Cache read Output
OpenAI gpt-6-luna (small) $0.10 $0.125 (30 min) / $0.25 (12 h) $0.01 $0.50
OpenAI gpt-6.2-astra (flagship) $8.00 $10.00 (30 min) / $20.00 (12 h) $0.40 $40.00
Anthropic Claude Haiku 5.5 (small) $0.10 $0.125 (5 min) / $0.20 (1 h) $0.01 $0.50
Anthropic Claude Fable 5.2 (flagship) $8.00 $10.00 (5 min) / $16.00 (1 h) $0.20 $40.00

A few notes so the table doesn’t mislead you:

  • OpenAI’s models page calls GPT-6.2 Astra its flagship model and describes GPT-6 Luna as its most efficient model for high-volume tasks. Anthropic’s models page suggests starting with Claude Opus 5.5 ($4 input, $20 output) for most work and using Fable 5.2 for the most demanding reasoning. I picked Fable 5.2 as the top end.
  • Long prompts cost more on some models. OpenAI prices above 272K input tokens separately. Claude Haiku 5.5 charges higher rates when the prompt is over 100,000 tokens ($0.50 input, $2.50 output).
  • Batch is half price. Both providers have a Batch API: you submit many requests, results come back later, and you pay half. Anthropic states a 50% discount; OpenAI’s Batch table lists exactly half the standard rates for these models (gpt-6.2-astra at $4 input and $20 output, for example).
  • Web search costs $10 per 1,000 searches on both. OpenAI bills the search content tokens at the model’s token rates. Anthropic counts search results as input tokens, in that turn and in later turns.
  • Token counts differ by model. Anthropic notes that Claude 4.7 and later use a tokenizer that produces roughly 30% more tokens for the same text. The same prompt is not the same number of tokens everywhere.

The small models cost about 1/80 of the flagships per token. That gap is the single biggest lever in this post.


How prompt caching works

Every call, the model has to process your whole prompt from the start. If the first 6,000 tokens are the same system prompt every time, that’s wasted work. Prompt caching lets the provider keep the processed version of that shared beginning (the prefix) for a while, and charge you much less to reuse it.

The rule that matters on both providers: the cache only matches an identical prefix. One changed character early in the prompt, and everything after it is a miss. (Why it has to be a prefix, and what’s being stored, is the KV cache from Long Context and the KV Cache.)

OpenAI: automatic, with a newer twist

On OpenAI, caching is on by default for supported models. You don’t have to mark anything. But the rules changed with GPT-5.6, so which model you use matters.

GPT-5.6 and later (including gpt-6-luna and gpt-6.2-astra):

  • The cacheable prefix needs at least 1,024 visible input tokens.
  • OpenAI places a breakpoint automatically at the end of the latest eligible message. You can also switch to an explicit mode and place breakpoints yourself.
  • Writes now cost money: 1.25 times the normal input rate for the default 30-minute lifetime, 2.5 times for 12 hours (Responses API only). That’s the price instead of normal input, not on top of it.
  • Reads cost 0.1 times input on most of these models, and 0.05 times on a few named ones, including GPT-6.2 Astra.
  • prompt_cache_options.ttl picks the lifetime: "30m" (default) or "12h".
  • prompt_cache_key is optional and used to split cache accounting, for example per customer. Routing is automatic.

Earlier models (for example gpt-5.5 and gpt-5.4-nano):

  • No extra charge for cache writes.
  • The minimum cacheable length varies with request settings, and cached_tokens is rounded down to a multiple of 128.
  • prompt_cache_key helps route requests that share a prefix to the same cache. OpenAI suggests about 15 requests per minute per key, and spreading busier traffic across more keys. It improves the odds of a hit; it doesn’t guarantee one.
  • prompt_cache_retention is "in_memory" (usually about 5 to 10 minutes of inactivity, up to an hour) or "24h".

The OpenAI docs also include a useful warning they call the minimum cacheable length cost trap. If your shared prefix is shorter than 1,024 tokens, padding it up to 1,024 just to get it cached can cost more than it saves, because you pay for the extra tokens and the write. With the default multipliers, a prefix of 102 tokens or fewer never benefits.

Anthropic: you say what to cache

On Claude, nothing is cached unless you ask. There are two ways:

  • Automatic caching: one cache_control field at the top level of the request. The API puts the breakpoint on the last cacheable block and moves it forward as the conversation grows.
  • Explicit breakpoints: cache_control on specific content blocks, for exact control. You can have up to 4 breakpoints per request.

The rest of the mechanics:

  • Order is fixed: the cache prefix is built from tools, then system, then messages. Changing something at one level invalidates that level and everything after it. Editing a tool definition invalidates the whole cache.
  • Lifetimes: 5 minutes by default. Add "ttl": "1h" for an hour. Each time the cached content is read, the lifetime is refreshed for free.
  • Prices: a 5-minute write costs 1.25 times base input, a 1-hour write 2 times. A read is 0.1 times on most models, 0.05 times on Opus 5.5 and Sonnet 5.5, and 0.025 times on Fable 5.2 and 5.1. Anthropic notes the 5-minute cache pays for itself after one read, the 1-hour cache after two.
  • Minimum length: 512 tokens on current models like Haiku 5.5 and Fable 5.2, up to 4,096 on some older ones. A shorter prompt simply isn’t cached, and no error is returned.
  • Lookback: the API checks at most 20 positions back from each breakpoint for an earlier cache entry. A breakpoint on something that changes every request (like a timestamp) never hits.
  • Thinking settings matter: changing the thinking configuration always invalidates the message blocks, and changing effort can too.

Why static content goes first

Both systems match from the start of the prompt. So the shape of a cache-friendly prompt is always the same:

  1. Tool definitions (stable).
  2. System prompt, rules, examples, reference documents (stable).
  3. Cache breakpoint here.
  4. Conversation history (grows, but only at the end).
  5. The new user message and anything retrieved for it (changes every call).

The classic mistake is putting something dynamic at the top: today’s date, the user’s name, a request ID, a randomly ordered list of tools. That one line turns every call into a miss. If it changes per request, it goes at the bottom.


Reading the usage object

You don’t have to guess any of this. Every response comes with a usage object that tells you what you were charged for. But the two providers count input differently, and that trips people up.

An OpenAI Responses API usage block looks like this:

"usage": {
  "input_tokens": 6800,
  "input_tokens_details": { "cached_tokens": 6000, "cache_write_tokens": 0 },
  "output_tokens": 1550,
  "output_tokens_details": { "reasoning_tokens": 1300 },
  "total_tokens": 8350
}

On OpenAI, cached_tokens and cache_write_tokens are inside input_tokens. The fresh input is input_tokens - cached_tokens - cache_write_tokens. And reasoning_tokens is inside output_tokens: here 1,300 of the 1,550 output tokens were thinking, and only 250 were the answer. To count web searches, count the web_search_call output items whose action.type is search.

A Claude usage block looks like this:

"usage": {
  "input_tokens": 800,
  "cache_read_input_tokens": 6000,
  "cache_creation_input_tokens": 0,
  "output_tokens": 1550,
  "server_tool_use": { "web_search_requests": 0 }
}

On Claude, input_tokens is only the part after the last cache breakpoint. Total input is input_tokens + cache_read_input_tokens + cache_creation_input_tokens. output_tokens includes the full thinking. Web searches are counted for you in server_tool_use.

Here’s a small Python function for each. Log the result next to every call.

# Dollars per 1M tokens. Copy from the official pages; they change.
ASTRA = {"in": 8.00, "read": 0.40, "write": 10.00, "out": 40.00}
FABLE = {"in": 8.00, "read": 0.20, "write": 10.00, "out": 40.00}

def openai_cost(u, p, searches=0):
    d = u.get("input_tokens_details", {})
    read = d.get("cached_tokens", 0)
    write = d.get("cache_write_tokens", 0)
    fresh = u["input_tokens"] - read - write   # reads and writes are INSIDE input_tokens
    return (fresh * p["in"] + read * p["read"] + write * p["write"]
            + u["output_tokens"] * p["out"]) / 1e6 + searches * 0.01

def anthropic_cost(u, p):
    fresh = u["input_tokens"]                  # already excludes reads and writes
    read = u.get("cache_read_input_tokens", 0)
    write = u.get("cache_creation_input_tokens", 0)
    searches = u.get("server_tool_use", {}).get("web_search_requests", 0)
    return (fresh * p["in"] + read * p["read"] + write * p["write"]
            + u["output_tokens"] * p["out"]) / 1e6 + searches * 0.01

Run on the two example blocks above, these return $0.0708 for the OpenAI flagship and $0.0696 for the Claude flagship. Of the $0.0708, $0.062 is output, and $0.052 of that is reasoning nobody reads.

Two things to watch for in your own logs. If you expected a cache hit and see cached_tokens: 0 (or both Claude cache fields at 0), something at the top of your prompt is changing, or your prefix is below the minimum. And if reasoning_tokens is most of output_tokens, effort is the first knob to try.


The formula

Put together, one call costs:

cost = (fresh input × input price + cache reads × read price + cache writes × write price + (reasoning + visible output) × output price) ÷ 1,000,000 + tool calls × tool fee

Then multiply by calls per day. That’s it. Everything else in this post is about which of those terms is biggest for your traffic.


A worked example: Lantern Bikes’ support bot

Lantern Bikes is a fictional e-bike shop. Its support bot answers questions about orders, delivery and warranty. All numbers below are assumptions for illustration, not measurements.

  • 2,000 calls a day, 30 days: 60,000 calls a month.
  • 6,000-token stable prefix: system prompt, return policy, warranty rules, tool definitions.
  • 800 fresh tokens per call: the customer’s message plus their order details.
  • 250 visible output tokens per reply.
  • Reasoning tokens by effort (assumed): 0 at none, 1,300 at low (close to the nano measurement above), 5,000 at high.
  • Cache hit rate 95% when caching is on. The 5% of misses pay the short-lifetime write price on the prefix.
  • Web search, when on: one search per call, adding 3,000 input tokens of results.
  • Same token counts on every model, to keep the comparison simple. Real tokenizers differ.

I ran every row in Python. Monthly cost:

Setup Small (gpt-6-luna or Haiku 5.5) gpt-6.2-astra Claude Fable 5.2
Effort none, cache on $17.97 not offered not offered
Effort low, cache on $56.97 $4,420.80 $4,352.40
Effort high, cache on $167.97 $13,300.80 $13,232.40
Effort low, cache off $87.30 $6,984.00 $6,984.00
Effort low, cache on, web search every call $674.97 $6,460.80 $6,392.40

“Not offered” because GPT-6 Astra rejects effort none, and Fable 5.2’s thinking is always on. Claude Haiku 5.5 accepts thinking: {type: "disabled"} at effort high or below, which is its version of “none”. At these prices, gpt-6-luna and Haiku 5.5 come out identical, so they share a column.

What the table says:

  • Model choice is 78 times. The small model at low costs $56.97; the OpenAI flagship at low costs $4,420.80. Nothing else in the table comes close.
  • Effort is about 3 times. On the small model, low costs 3.2 times none, and high costs about 3 times low. Same on the flagships. The customer sees a 250-token reply in every row.
  • Caching is about 1.5 times. Turning it off costs the small model 1.53 times more, and the flagship $2,563.20 more a month.
  • Web search flips the picture on small models. On the small model, one search per call takes the bill from $56.97 to $674.97, nearly 12 times. The $0.01 search fee is bigger than the whole rest of the call. On the flagship it adds 46%, because the tokens were already expensive.

That last point is easy to miss, so here it is as a picture: one call, split into its parts.

Flagship (gpt-6.2-astra): 10.77¢ per call input 28% reasoning 48% 9% 9% cached prefix 5% Small (gpt-6-luna): 1.12¢ per call web search fee 89% ($0.01) everything else 11% cached prefix uncached input reasoning visible output tool fee Fictional bot: 6,000-token prefix (95% hits), 800 new tokens, 3,000 search tokens, 1,300 reasoning + 250 visible output tokens, one search. OpenAI prices, Nov 2026.
On the flagship, hidden reasoning is the biggest slice; on the small model, a single web search is almost the whole bill.

Two more things the example hides:

  • Batch would halve any row where the answer can wait. A support bot can’t, but the nightly job that tags yesterday’s 2,000 tickets can.
  • The 95% hit rate is doing work. With 2,000 calls spread over a working day, a request arrives every minute or so and the cache stays warm. A bot with 50 calls a day might see the 5-minute or 30-minute cache expire between most calls, pay the write price over and over, and be better off with a longer lifetime or no caching at all. Check cached_tokens before you assume.

A checklist for cutting the bill

In order. The first item is the one people skip.

1. Measure first. Log the usage object and a computed cost for every call, tagged by feature. You can’t cut what you haven’t split. A week of logs usually shows one feature, or one long prompt, eating most of the bill.

2. Use the cheaper model, and move the checking into code. The 78 times gap is the biggest one. A small model plus a validator (does the JSON parse, is the order ID real, is the reply under 120 words, does it mention a refund amount we didn’t offer) often beats a flagship on cost and is easier to trust. That’s what the sister post does in detail, and Treat the LLM Like an Unreliable API covers the patterns. Use an eval set to prove the small model is good enough, rather than guessing.

3. Lower reasoning effort. Try none or low first and only raise it where evals show you need it. Reasoning is billed as output and you can’t see it, so it’s where costs grow quietly. If you change effort mid-conversation, check the caching docs first: on both providers, changing it the wrong way can invalidate the cache.

4. Cache the prefix. Stable content first, dynamic content last, nothing per-request at the top. On Claude, add cache_control. On OpenAI, check that the prefix is over the minimum and that cached_tokens goes up on the second call.

5. Batch offline work. Evals, nightly classification, backfills, embeddings for a new document set. If nobody is waiting, it should be half price.

6. Cap the output. Set max_output_tokens (OpenAI) or max_tokens (Claude), and ask for short answers in the prompt. Remember the cap includes reasoning. OpenAI warns a call can hit the limit before producing any visible output, so you pay for input and reasoning and get nothing back. Leave room, then lower effort instead.

7. Don’t pay for tool calls when the data is free. If you already have the answer in your database, a free public API, or a page you can fetch yourself, pass it in as text instead of asking the model to search. On a small model, one paid search can cost more than everything else in the call combined. On Claude, web fetch has no per-use fee, only the tokens of the page it brings back.


Key ideas

  • A call has up to six meters: input, cache reads, cache writes, reasoning, visible output and tool fees. The headline per-token price covers only some of them.
  • Reasoning tokens are billed as output and are invisible. In one measured nano call, they were 1,308 of 1,384 output tokens. Effort is a cost setting.
  • Caching only matches an identical prefix. Put tools, rules and documents first, and anything that changes per request last.
  • The providers count input differently. OpenAI’s input_tokens includes cached tokens; Claude’s excludes them. Write your cost function to match.
  • Model choice is the biggest lever (about 78 times in the example), then effort (about 3 times), then caching (about 1.5 times).
  • On small models, flat tool fees dominate. One $0.01 web search can be most of the call.
  • Measure first, then cut in this order: model, effort, caching, batch, output caps, paid tools.

Sources: OpenAI, API pricing, Prompt caching, Reasoning models, Web search and Models; Anthropic, Pricing, Prompt caching, Thinking and Models overview. All checked November 30, 2026.

Related: Making a Nano Model Do a Flagship’s Job, What’s a Token, and Why AI Has Limits, and The Hidden Costs of AI Tools Nobody Shows in the Demo.