# Mission 5.1: Why does the support chat get more expensive with every round?

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/einsatz-5-1

Belongs to [Chapter 5: Context](https://llm.yoga/en/05-kontext.md).

Structure: the case, the explanation, a hands-on tool, check questions, wrap-up. The answers to all questions are collected at the end.

## The case

**Miriam**, runs customer support:

> “Our support bot runs on Claude Opus 5.5. Short chats cost almost nothing. But the long ones, where a customer goes back and forth twenty times, are much more expensive on the bill than their length suggests. Are we paying twice?”

Billing is per token, the word pieces the model splits text into, with input and output charged separately. Here is a conversation with the values from the worked example in the chapter:

Fixed part (the bot’s standing instructions and the description of its tools): 3,000 tokens. Each round has a question of 200 and an answer of 400 tokens.

Claude Opus 5.5: $4 per million input tokens, $20 per million output tokens (Anthropic’s pricing page, as of November 25, 2026).

A conversation with 20 rounds costs $0.87 in total.

**Question 1 (prediction):** A customer writes 100 rounds instead of 20, five times as many. What does this conversation cost?

- A) About $4.40, five times as much.
- B) Hardly more than $0.87, since you only pay for what’s new.
- C) About $14, sixteen times as much.

## What’s behind it

Picture a consultant who forgets everything after each phone call. So before every call you send her the complete file by courier, one page longer each time. The courier charges by weight, so you pay for the old pages again on every call.

A chat with a language model works exactly like this. According to the docs, the API that programs use to talk to Claude is **stateless**: it remembers nothing between two requests, and each request contains the complete history so far. The feeling of a conversation comes from the application around it. It keeps the history and puts it in front of every new message. The input of a round is therefore the fixed part plus all previous questions and answers: in the example, 3,200 tokens in round 1, 8,600 in round 10 and 14,600 in round 20.

For Miriam this means the provider is billing correctly, but costs grow faster than the number of rounds, in the long run roughly with its square. At 100 rounds it’s only sixteen times as much, not twenty-five times, because the fixed part and the output grow only in step with the rounds. Over 20 rounds, 178,000 input tokens add up, even though the text of the whole conversation is only 15,000 tokens. You are billed for almost twelve times that.

Two levers help. **Prompt caching**: if less than five minutes pass between two rounds, each round reads the history so far from the cache, temporary storage on the provider’s side, for a twentieth of the input price. Only what’s new is written to it, at 1.25 times the price. That brings the worked example down from $0.87 to about $0.27. And a shorter history: if a long chat is summarized, the next round starts with less baggage. That slows the growth itself.

### In more detail: the math for 20 and 100 rounds

Input in round n: 3,000 (fixed) + n × 200 (all questions so far) + (n − 1) × 400 (all previous answers), simplified 2,600 + 600 × n.

Sum over 20 rounds: 20 × 3,000 + 200 × (1 + 2 + … + 20) + 400 × (0 + 1 + … + 19) = 60,000 + 42,000 + 76,000 = 178,000 input tokens. Cost: 178,000 × $4 ÷ 1,000,000 = $0.712, plus 20 × 400 = 8,000 output tokens × $20 ÷ 1,000,000 = $0.16. Together $0.87.

For 100 rounds, the same formula gives 3,290,000 input tokens ($13.16) and 40,000 output tokens ($0.80), together $13.96.

With caching over the whole history (chapter 5): each round writes its new part to the cache, round 1 the first 3,200 tokens, each later one 600 (the last answer and the new question), together 3,200 + 19 × 600 = 14,600 tokens × $4 × 1.25 ÷ 1,000,000 = $0.073. The rest is read: 178,000 − 14,600 = 163,400 tokens × $4 × 0.05 ÷ 1,000,000 = $0.033. With the output, about $0.27. The task in the calculator below assumes no caching; the prompt caching switch adds it.

## Try it

**Cost calculator for one conversation**

**Task:** Miriam wants a conversation to stay under $1. Push the rounds up as far as you can without going over $1. Then try what a bigger growth does, for example when customers paste long error messages into the chat.

The calculator needs JavaScript. The math for the case: input per conversation = rounds × 3,200 + 600 × rounds × (rounds − 1) ÷ 2, output = rounds × 400. At 21 rounds that’s 193,200 input and 8,400 output tokens, together $0.94. At 22 rounds $1.01, at 100 rounds $13.96.

Fixed part 3,000 tokens, each question 200 tokens, each answer 400 tokens, as in the worked example. The growth lengthens the history; the answer length stays at 400 tokens.

## Check

**Question 2 (check question):** Miriam asks: “Why doesn’t the model just remember the history instead of reading it again every time?” What do you answer?

- A) It does remember it, but the provider charges for it again anyway.
- B) It remembers it as long as the chat window stays open.
- C) It keeps nothing between two requests, so everything has to go into the request.

**Question 3 (check question):** Prompt caching brings the worked example down from $0.87 to about $0.27. What has to be true for that?

- A) The beginning stays the same character for character, and the next round comes within five minutes.
- B) Turning on caching once is enough; after that every round gets cheap by itself.
- C) The answers have to stay short, because caching mainly saves on output.

**Question 4 (check question):** A colleague suggests Claude Sonnet 5.5, which costs half as much per token. Does that solve Miriam’s problem with the long chats?

- A) Yes, at half the price per token, long chats are no longer a problem.
- B) It cuts the bill in half but does nothing about the growth.
- C) No, all Claude models cost the same per token.

## Done

**What you can do now**

- You can explain to Miriam why a chat sends, and pays for, the whole history again in every round.
- You can work out the input of a round: the fixed part plus all previous questions and answers.
- When someone shows you a bill with expensive long chats, you first check whether prompt caching is on and whether long conversations get summarized.

### Two cards for review

**Card 1:** In the worked example from chapter 5, round 1 of a support chat costs just over 2 cents, round 20 of the same chat just under 7 cents. Where does the difference come from?

**Card 2:** True or false? “A long system prompt costs only once per conversation.”

- [Next mission: A million tokens, so put all 50 contracts in?](https://llm.yoga/en/einsatz-5-2.md)
- [Try it on your Mac](https://llm.yoga/en/mac-5-1.md)

## Read more in the chapter

The full text from the chapter, with the reasoning, calculations and sources:

- [Every request starts from zero](https://llm.yoga/en/05-kontext-1.md)
- [Why long contexts are expensive](https://llm.yoga/en/05-kontext-2.md)
- [Worked example: a conversation over 20 rounds](https://llm.yoga/en/05-kontext-2.md)

## Answers: only reveal them after the learner has answered or explicitly asks

**Question 1:** The correct answer is C.
- A: That’s what it would look like if every round cost the same. But every round sends the whole history so far again: round 1 has 3,200 input tokens, round 100 already 62,600. Together that comes to about $14.
- B: That would be true if the model remembered the conversation. It doesn’t: every round sends the whole history so far, and every token of it is charged again.
- C, correct: Using the formula from the chapter, that’s 3,290,000 input tokens, or $13.16, plus $0.80 for the output. Five times as many rounds, sixteen times the cost.

**Question 2:** The correct answer is C.
- A: A model learns nothing while answering; its parameters stay the same (chapter 1). Whatever is not in the tokens of the request doesn’t exist for the model. So the bill reflects real work.
- B: The open window belongs to the application, not to the model. The application keeps the history and sends all of it with every round. The model only sees what’s in the request, even if the window has been open for hours.
- C, correct: The API remembers nothing between two requests; you always send the complete history along. The “conversation” is the application’s doing: it keeps the history and puts it in front again.

**Question 3:** The correct answer is A.
- A, correct: The cache only hits on an identical beginning. For Opus 5.5, reading costs a twentieth of the input price. Each round writes what’s new to the cache at 1.25 times the price; that’s how the example calculates it, too.
- B: A timestamp in the first line of the system prompt ruins every hit, because then the beginning differs with every request. Fixed content goes first, changing content last.
- C: Output costs the same with or without caching, $0.16 in the example. The savings are only on input, that is, on the history sent along.

**Question 4:** The correct answer is B.
- A: The bill is cut in half, the growth stays. With Sonnet 5.5, too, 100 rounds cost about sixteen times as much as 20: $6.98 versus $0.44.
- B, correct: According to the pricing page, Sonnet 5.5 costs $2 and $10 per million tokens, so $0.44 for 20 rounds and $6.98 for 100. Caching and a shorter history are what tackle the growth itself.
- C: The prices differ: Opus 5.5 costs $4 and $20 per million tokens, Sonnet 5.5 half that. So it does get cheaper; long chats just keep growing out of proportion.

**Card 1:** Every round sends the whole history so far again: round 1 has 3,200 input tokens, round 20 already 14,600. That’s why the cost of a conversation grows faster than the number of rounds, in the long run roughly with its square. 100 rounds cost about sixteen times as much as 20.

**Card 2:** **False.** It goes along with every request and, without caching, is charged in full every time. Over 20 rounds, you pay for it twenty times. Prompt caching cuts that sharply, but only if the beginning stays the same character for character.
