Infographic · AI cost foundations

What a prompt really costs, and where the money goes.

Every call to a language model is billed per token. Most people look at the input. The bill is mostly in the output.

per 1M input tokens
$2
per 1M output tokens
$10
of the first question's cost was output
97%
Part IHow it's billed

Input vs output

An output token costs 5 times as much as an input token

Reading is cheap. Writing is expensive. Each square below is one dollar, for one million tokens on Claude Sonnet 5.5.

Input
$2
Output
$10
1 square = $1 per one million tokens.

The first question in the exercises

97% output
3% input: the question itself
A short question with a long answer. Almost the whole bill is the answer.

Shape of the work

The type of task decides which meter runs hardest

A chat answer is long, so output dominates. Classifying thousands of texts is the reverse: long inputs, a one-word answer.

Chat
one question
output 97%
Classification
10,000 texts · $15
input $10
output $5
Same model, same prices. Before you optimise, find out which meter your task actually runs on.

Where it goes

Try it: one request, split into input and output

Move the sliders. Unless the input is many times longer than the output, the amber part stays dominant.

Input tokens
Output tokens
Input 3% · $0.0006Output 97% · $0.020
per request
$0.021
per 1,000 requests
$20.60

Defaults: a short question (300 tokens) and a long answer (2,000 tokens). That gives the 97/3 split from chapter 01.

Part IIWhat gets counted

Count first

Counting is free, and it is exact

The count endpoint tells you the token total before you send anything. In the exercises it matched the bill to the token.

tokens predicted by count · free
29
tokens billed by live
29

Every message comes in a wrapper

“hoi”
11 tokens
the wordformatting around it, ~10 tokens
A one-word message still pays for its packaging. On 10,000 short calls that is 100,000 tokens of overhead.

Tokenizer & language

Every model counts differently, and Dutch costs more

An online counter built on another tokenizer guessed about half. And the same meaning in Dutch takes more tokens than in English.

Online counter
10
Claude
19
Tokens for the same sentence. The online counter estimated 47% too low.

Same meaning, two languages

English
14
Dutch
19
Dutch needed about 36% more tokens, even though the English sentence had more characters. Characters are not tokens.
Part IIITokens you don't see

Reasoning

Thinking tokens are invisible, but billed as output

Ask a harder question and the model thinks before it answers. You never see that text. You do pay for it, at the output price.

167 thinking · 92%14 visible answer
The train question: 181 output tokens, 1 square each. Judging by the answer alone, you would estimate 13× too low.

Effort is a cost dial

17 × 24
0
Hard question, effort high
167
Thinking tokens per question. With adaptive thinking the model decides how much to think; effort sets the ceiling.
Part IVSaving

Saving

Cut the answer, not the question

Halving the output saves far more than halving the input. Ask for shorter answers, structured output and no repetition of the question.

Now
$0.021
Input −50%
$0.020
Output −50%
$0.011
Cost per request, using the token counts from chapter 03. Halving the output saves 49%; halving the input saves 1%.

Caching

Pay a little extra once, then reuse almost free

A cache write costs 25% more than normal input. Every read after that gets 90% off. One reuse is enough to break even.

input, per 1M tokens
$2.00
cache write · +25%
$2.50
cache read · −90%
$0.20

Cumulative cost of the same prompt prefix

1 run, no cache
1.00
1 run, cached
1.25
2 runs, no cache
2.00
2 runs, cached
1.35
3 runs, no cache
3.00
3 runs, cached
1.45
Relative to one uncached run of the prefix. In the exercises, two runs together were 23% cheaper overall, output included.

Pitfall: input_tokens hides the cache

2,942 cached, not in input_tokens
18 reported in input_tokens, while 2,960 were processed
Add up cache_read_input_tokens and cache_creation_input_tokens too, or the dashboard looks too good to be true.

The limit: caching never touches output

input 22%
output 78%
Second cached run. With input made cheap, the answer is the bill again: back to chapter 07.

Batch

Half price, if you can wait

Send requests as a batch and the answer arrives later, at 50% off. For work nobody is waiting on, that is free money.

Direct
$15
Batch
$7.50
10,000 classifications from chapter 02. Good for nightly jobs, reports and bulk labelling; not for chat.
Part VForecasting

Estimate

You can know the bill before you build

Three numbers are enough: tokens in, tokens out, and how often it runs.

cost = (input × $2 + output × $10) ÷ 1,000,000 × requests

With 300 input and 2,000 output tokens per request, from chapter 03.

per month, at 10,000 requests
$206.00
per year
$2,472

Outlook

Today's price is not the real price

AI is heavily subsidised right now. That will not last. Plan with a margin: what does the same workload cost if prices go up?

×1
$206.00
×2
$412.00
×3
$618.00
×5
$1,030
Monthly cost of the workload from chapter 10 at ×1, ×2, ×3, and ×5 today's price. These are scenarios, not forecasts.

Check the source

Prices, model IDs and APIs go out of date

A forecast is only as good as the price table under it. Four checks from the exercises.

Sonnet 5.5InputCache writeCache readOutput
per 1M tokens$2$2.50$0.20$10
The misread: cache read seemed to be $2.50, more than plain input. That made no sense, so it was checked: it was the cache write column.
  1. Verify prices against the source
    The example prices and model IDs in pricing.json were wrong. Quick check: work out the cost of 1M tokens; it should equal the price per MTok.
  2. An illogical result means a reading error
    A cache read can never cost more than input. If the numbers say otherwise, re-read the table.
  3. The API changes under you
    budget_tokens no longer works on Sonnet 5.5. Adaptive thinking with effort replaced it.
  4. A subscription is not API credit
    A Pro subscription does not cover API use. That is billed separately, through the Console.

Common thread

Measuring beats assuming.

Almost every insight came from a number that turned out different than expected.

Expected
Measured
Tokenizer
10 tokens
19 tokens
Cache read price
$2.50
$0.20
Output tokens
14
181
Input processed
18
2,960

Contact

Want to see what your AI workflow really costs, before the subsidies end?

Get in touch

Source · costlab exercises, module 1 · Claude Sonnet 5.5 · prices checked September 29, 2026