Lesson 8
Why does every token cost money?
This lesson follows one chat about a trip to Goa. It shows what work each token needs, which chip does that work, why the answer costs more than the question, and why a long chat costs more than a short one.
1How does one token turn into a bill?
Every token is work for a GPU, a computer chip that does thousands of sums at the same moment. Running GPUs costs the company money every hour, so it charges you for every token.
The chain, step by step:
- 📝 You send text. For example: Plan a 3-day trip to Goa.
- 🔤 The text is cut into tokens, about 10 here (lesson 3).
- 🧮 Each token needs crores of small sums (section 2).
- ⏱️ A GPU does those sums (section 3).
- 💸 Every hour a GPU runs costs the company money.
- 🧾 So it charges for every token: the ones you send and the ones the model writes back.
- 💲Prices are given per million tokens (10 lakh tokens). Claude Opus 5.5 charges $4 for every 10 lakh tokens you send.
- 🪙One token costs very little. $4 ÷ 10,00,000 = $0.000004 for one token you send to Claude Opus 5.5.
- 📦The bill grows with the number of tokens. 1 lakh questions of 1,000 tokens each are 10 crore tokens. Sending them to Claude Opus 5.5 costs $400.
2How much work is one token?
One token needs about one multiply-and-add for every dial in the model. A multiply-and-add is one multiplication plus one addition. The dials are the model's parameters (lesson 2).
What the model does with one token:
- 📥 The token goes in as a list of numbers (lesson 4).
- ✖️ The numbers are multiplied by the dials and added up, layer after layer. A real layer also does a little more (lesson 2).
- 🎯 Out comes a chance for every possible next token, and one token is picked (lesson 6).
- 🔢In a small network, you can count the sums. Lesson 2's tiny network has 6 dials, so one pass did 6 multiplications: 1 × 3, 2 × 1, 1 × 2, 2 × 4, 5 × 2 and 10 × 1.
- 🦙A real model has crores of dials. Llama 3 8B, an open model from Meta, has 8 billion (800 crore) dials. So one token takes about 800 crore multiply-and-adds.
- 🧮Many of these sums can be done at the same time. In lesson 2's network, 1 × 3 does not need the result of 1 × 2. So a chip can work out both at the same moment.
3Why does a model need a GPU?
A model needs a GPU because a GPU does thousands of sums at the same moment. A normal computer chip, the CPU, does only a few at a time.
🧍 CPU: one shop, a few cashiers
Each cashier is fast. But 800 crore customers wait in one long line.
A few big cores
🏬 GPU: a hall with thousands of counters
Each counter is slower. But thousands of customers are served at once.
Thousands of small cores
A picture, not to scale. A customer is one multiply-and-add. Each square is one core, a worker that does one sum at a time: orange for the CPU, green for the GPU. A real example: the NVIDIA T4, a small GPU used in one of our books, has 2,560 cores.
Why GPUs cost the company a lot:
- 💾The model's dials must sit in the GPU's own memory while it runs. Llama 3 8B's 800 crore dials take 16 GB of memory, 2 bytes each (lesson 2).
- 🖥️A big model needs several GPUs at once. Llama 3 70B's dials take about 140 GB. An NVIDIA H100, a common data-centre GPU, holds 80 GB, so this model needs at least two.
- 💸GPUs are often rented by the hour. In October 2026, one rental company listed an H100 at $3.99 an hour.
- 🔌GPUs use a lot of electricity. A server for large models uses 10,000 to 15,000 watts. A home geyser uses about 2,000 watts, so one server uses as much power as 5 to 7.5 geysers.
4Why does the model's answer cost more than your question?
On Claude's price list, an output token (a token the model writes) costs 5 times as much as an input token (a token you send). Anthropic does not say why.
Engineers explain it with rounds of work: the model reads your whole question in one round, but writes the answer one token per round. Use the buttons to go through the first reply of the Goa chat, one step at a time:
📥 1. Your message goes in
The app sends 10 input tokens: Plan a 3-day trip to Goa. The model has not worked yet.
📖 2. Round 1: all 10 tokens together
All 10 tokens go through the dials together, side by side. At the end of the round, the model picks the first token of its plan.
✍️ 3. Round 2: one token goes through
The whole text is the input again (lesson 1). But the work for the first 10 tokens was saved in round 1, so only the newest token goes through the dials. The model picks the next token.
✍️ 4. Round 3: one more token
Again only the newest token goes through the dials, and the model picks the next one. Round 3 had to wait for round 2, because it needs round 2's token.
🧾 5. The whole plan: 300 rounds
The 300-token plan took 300 rounds, one after another. Round 1 handled your 10 tokens. Each of the other 299 rounds handled 1 token.
Rounds of work so far0
Tokens worked on in the latest round–
One square is one token. Orange squares: your tokens, once read. Green squares: tokens the model has written. Dashed squares: not reached yet. The output row shows only the first 10 of the 300 tokens. The token counts are our example.
Why a round that makes one token is costly:
- 🚚In every round, the GPU moves all the dials from its memory to its cores. For Llama 3 8B, that is about 16 GB moved in every round.
- 🍳When reading, one round serves many tokens. When writing, one round serves one token. A cook brings the whole spice box from the store room for each trip. Ten plates ordered together need one trip. Ten plates ordered one after another need ten trips.
- ⏳So an output token keeps the GPU busy for longer. In the Goa reply on its own, round 1 handled 10 input tokens: a tenth of a round each. Every later round handled 1 output token: a whole round each.
Why the difference is 5 times, not more:
- 👥A server works on many people's chats in the same round. So one move of the dials serves many tokens, when writing and when reading. If 50 chats share a writing round, the 16 GB moved serves 50 output tokens, one for each chat. A reading round can read every chat's whole question at once, so it serves far more tokens than that. (50 is our example.)
An output token still uses more of the GPU than an input token. Claude's price list puts the difference at 5 times.
5How much does one question cost?
Prices are for 10 lakh tokens. So multiply the input tokens by the input price and divide by 10 lakh. Do the same for the output tokens with the output price. Then add the two. These are the real prices of three Claude models:
| Model | Input | Output |
|---|---|---|
| Claude Opus 5.5 (big) | $4.00 | $20.00 |
| Claude Sonnet 5.5 (middle) | $2.00 | $10.00 |
| Claude Haiku 5.5 (small) | $0.10 | $0.50 |
Move the sliders to set the tokens. They start at a 1,000-token question and a 500-token answer:
Claude Opus 5.5
Claude Haiku 5.5
Cost of one question and its answer, in US dollars, at the real prices in the table above. The token counts are yours to choose. Haiku 5.5's price is for inputs up to 1 lakh tokens, so the slider stops there. The green box is the small model.
- 🏖️The first reply of the Goa chat is almost all answer. On Claude Opus 5.5: 10 × $4 ÷ 10,00,000 = $0.00004 for your message, and 300 × $20 ÷ 10,00,000 = $0.006 for the plan. Total $0.00604, and over 99% of it is the plan.
Why is a small model cheaper?
- 🪶Fewer dials means fewer multiply-and-adds for each token. Llama 3 70B has about 9 times as many dials as Llama 3 8B, so each token takes about 9 times the work.
- 🏷️Claude's prices are also lower for the smaller model. Claude Haiku 5.5 costs 1/40 of Claude Opus 5.5 for every token, for questions up to 1 lakh tokens.
- 🤷Anthropic does not publish how many dials each Claude model has. So the dial counts on this page come from Llama 3, whose sizes are public.
6What is a context window?
A context window is the most tokens one request can hold: your input and the model's answer together.
If a request needs more tokens than that, it does not fit.
- 📐Each model has its own size. Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 hold 1 million tokens (10 lakh). The older Claude Haiku 4.5 holds 200,000 (2 lakh).
- ➕Input and answer share the same space. Send 9,90,000 tokens into a 10 lakh window, and only 10,000 are left for the answer.
- 💸You pay for every token you put in it. Filling Claude Opus 5.5's 10 lakh window with input costs $4, on every request.
- 🔁One reason for the limit: attention (lesson 5) compares each token with every token before it. 1,000 tokens make about 5 lakh comparisons (1,000 × 1,000 ÷ 2). 10,000 tokens make about 5 crore. So 10 times more tokens means 100 times more comparisons.
7Does a model remember what you said earlier in a chat?
No. The model remembers nothing between messages. Every request starts with nothing from the messages before it. The chat app sends the whole conversation again with each new message, so the model can read it.
Use the buttons to go through one chat, one step at a time, and see what the app sends:
💬 Turn 1: you ask a question
The app sends only your message: 10 tokens. The model writes a 300-token plan.
💬 Turn 2: you ask for a change
The app sends the whole chat so far, plus your new message: 316 tokens. You typed only 6.
💬 Turn 3: one more change
The list grows again, with the last answer and your new message: 574 tokens sent.
❓ Turn 4: "What did I ask first?"
The model can answer only because your first message is in the list it gets: 861 tokens sent.
🧾 The total
You typed 31 tokens. The app sent 1,761 input tokens over four turns, about 57 times as many, and you pay for all of them.
- 🙋 YouPlan a 3-day trip to Goa.10
- 🤖 ModelDay 1: beaches in the north…300
- 🙋 YouMake day 2 cheaper.6
- 🤖 ModelDay 2: take the bus to…250
- 🙋 YouAdd a fort on day 3.8
- 🤖 ModelDay 3: start at the fort…280
- 🙋 YouWhat did I ask first?7
One made-up chat. The messages and token counts are our example. Orange rows are new this turn. The app sends every row in the list, old and new.
- 📈Each turn costs more than the one before, because the list only grows. Turn 1 sent 10 tokens. Turn 4 sent 861.
- 🗒️"Memory" features in chat apps save short notes about you and paste them into each new chat. The note User is vegetarian is added to every request. The model itself learned nothing.
Now think of a chat where you paste a 500-page PDF. The app would send every page again with every question. How does a chatbot answer from a 500-page PDF without that? Lesson 9 shows how.
Where this comes from
- One token = one pass through every dial; out comes a chance for every next token: Hands-On Large Language Models (Alammar, Grootendorst; O'Reilly 2024), ch.3, PDF p.118-126 (tokenizer → stack of blocks → LM head gives every token a score, turned into chances; run once per new token).
- About one multiply-and-add per dial per token: Kaplan et al., "Scaling Laws for Neural Language Models" (OpenAI, 2020), §2.1: a forward pass costs about 2N operations per token for N parameters, i.e. one multiply and one add per parameter. N there counts the parameters outside the embedding table, and attention adds a term that grows with the text length; "about" covers both. arxiv.org/abs/2001.08361.
- Lesson 2's tiny network: 6 dials (3, 1, 2, 4 in layer 1; 2, 1 in layer 2), inputs 1 and 2; the six multiplications are the ones lesson 2 shows. Made-up numbers, labelled there.
- GPUs do many multiplications at once: How Large Language Models Work (Raff, Farris, Biderman; Manning 2025), ch.3: "Matrix multiplication makes attention efficient when implemented on GPUs because they can perform many multiplication operations in parallel."
- Llama 3 8B, 8 billion (800 crore) dials, 2 bytes each, 16 GB: Hugging Face, meta-llama/Meta-Llama-3-8B: 8,030,261,248 parameters stored as BF16, 16,060,556,376 bytes (checked for lesson 2). Llama 3 70B: Meta, "Introducing Meta Llama 3" (18 April 2024), 8B and 70B sizes; 70 ÷ 8 = 8.75, "about 9 times"; 70 billion (7,000 crore) × 2 bytes = 140 GB. ai.meta.com/blog/meta-llama-3.
- NVIDIA T4, 2,560 cores: NVIDIA T4 Tensor Core GPU datasheet (2,560 NVIDIA CUDA cores). nvidia.com/en-us/data-center/tesla-t4. The T4 is the free Colab GPU used in Hands-On Large Language Models (ch.3, PDF p.131).
- Big models need many GPUs: How Large Language Models Work, ch.1: a large model does not fit "inside the most powerful graphics processing units (GPUs) with 80 gigabytes of memory", and "many GPUs are required". Newer GPUs hold more (the B200 below has 180 GB), so the page names the H100.
- H100, 80 GB, $3.99 an hour: Runpod pricing page (accessed 2026-10-31): "H100 SXM 80 GB VRAM … $ 3.99 /hr"; "B200 180 GB VRAM … $ 7.99 /hr". One provider's on-demand list price (its "Secure Cloud" rate; a cheaper "Community Cloud" H100 is $2.69); big labs run their own GPUs and do not publish their cost. runpod.io/pricing.
- 10,000 to 15,000 watts per server: How Large Language Models Work, ch.7, PDF p.137-138: "A high-end server for running the larger LLMs available today gets into the 10,000 to 15,000 watt range." The 2,000-watt geyser is a typical home rating, used as a rough comparison: 10,000 ÷ 2,000 = 5 and 15,000 ÷ 2,000 = 7.5.
- Input read together, output one token per round, earlier work saved: Hands-On Large Language Models, ch.3, PDF p.127 ("Each of these input tokens then flows through its own computation path") and PDF p.130 (with the keys and values cache, "only one processing stream is active" when generating the next token). NVIDIA Technical Blog, "Mastering LLM Techniques: Inference Optimization" (Verma, Vaidya; 17 Nov 2023): the input step "effectively saturates GPU utilization"; output tokens come "one at a time"; that step "underutilizes the GPU compute ability" and "The speed at which the data (weights, keys, values, activations) is transferred to the GPU from memory dominates the latency". developer.nvidia.com/blog/mastering-llm-techniques-inference-optimization. Anthropic does not publish why output is priced at 5 times input; this is the explanation engineers give. The same blog, on batching: "Since multiple requests use the same model, the memory cost of the weights is spread out." The 16 GB per round is Llama 3 8B's size from above. The cook is our comparison.
- Prices: Opus 5.5 $4 / $20, Sonnet 5.5 $2 / $10, Haiku 5.5 $0.10 / $0.50 per million (10 lakh) input / output tokens; 1M (10 lakh) context for all three; Haiku 4.5 200K (2 lakh): Anthropic Claude API model table, via the claude-api skill, cached 2026-10-06. Haiku 5.5's price applies to prompts up to 100K (1 lakh) tokens ($0.50 / $2.50 beyond), which is why the calculator stops at 1 lakh input tokens. Anthropic first-party API rates; cloud partners price separately. Dollars are not converted to rupees. Anthropic does not publish parameter counts for Claude models.
- The worked sums: $4 ÷ 1,000,000 = $0.000004 a token; 1,00,000 × 1,000 = 10 crore tokens × $4 ÷ 1,000,000 = $400. Calculator: 1,000 × $4 ÷ 1,000,000 = $0.004; 500 × $20 ÷ 1,000,000 = $0.010; total $0.014; × 1,00,000 = $1,400. Haiku 5.5: $0.0001 + $0.00025 = $0.00035; × 1,00,000 = $35. Ratio 4 ÷ 0.10 = 20 ÷ 0.50 = 40. A full 10 lakh window: 1,000,000 × $4 ÷ 1,000,000 = $4. Goa reply: 10 × $4 ÷ 1,000,000 = $0.00004; 300 × $20 ÷ 1,000,000 = $0.006; total $0.00604; 0.006 ÷ 0.00604 = 99.3%.
- Context window = input + output; attention compares each token with the ones before it: Rahul's blueprint, Module 8.1. Hands-On Large Language Models, ch.3, PDF p.127-128 (everything in the prompt and everything generated must fit the context length). Comparison counts: 1,000 × 1,000 ÷ 2 = 5 lakh; 10,000 × 10,000 ÷ 2 = 5 crore (each token also compares with itself, which adds a little). "One reason" because memory for the saved work also grows with the text.
- The model remembers nothing; the app resends the chat; memory = saved notes pasted back in: Rahul's blueprint, Module 8.2 and Part 4, misconception 9.
- Pasting a whole document into every request: the course transcript, Part 6 ("it's expensive. You're paying for tokens…"); lesson 9.
- Made up on purpose: the Goa chat, every message in it and every token count (10, 300, 6, 250, 8, 280, 7; sent per turn 10, 316, 574, 861; total 1,761, about 57 times the 31 typed); "about 10 tokens" for the Goa sentence; the 300-token plan in the rounds stepper; 50 chats sharing a round; the 9,90,000-token example; the vegetarian note; the CPU and GPU pictures (not to scale).