#214рдпрд╣ рд╡реАрдбрд┐рдпреЛ рдФрд░ рдЗрд╕рдХрд╛ рдЯреЗрдХреНрд╕реНрдЯ рдЕрдВрдЧреНрд░реЗрдЬрд╝реА рдореЗрдВ рд╣реИред
Quadratic chat cost: why each new message costs more than the last
Every message in an AI chat resends the whole history. See why a 40-turn chat billed about 22 times its own length, and why the cost grows with the square.
рд╡рд┐рд╕реНрддрд╛рд░ рд╕реЗ
What quadratic chat cost is
When you chat with an AI model, each new message does not travel alone. The app sends the entire conversation so far, plus its own hidden instructions, and whoever pays by the token, such as a company running a chatbot, is billed for every token of it. (A token is a small chunk of text, often a word or part of one.) So each turn costs a little more than the one before, and the total over a conversation grows with the square of its length. That is what "quadratic" means here: a chat twice as long costs far more than twice as much.
What the video shows
The video makes the point with a single 40-turn chat, in which every new message resends the whole chat. At the 40th turn, the user types a short question of just 17 tokens, but 4,947 tokens of input are billed for that turn, because the whole history goes along with it. The message is tiny; what gets paid for is everything behind it. Long conversations get expensive fast.
An everyday example
Imagine a pen pal who forgets everything, so every letter you send must include a photocopy of every letter so far. Postage is paid by weight. Your first letter is one page. Your tenth letter carries ten pages. Add up all ten envelopes and you have paid postage on 55 pages, even though you only wrote ten. Keep going to twenty letters and you have paid for 210 pages. Twice the letters, nearly four times the postage.
A chat with an AI works the same way, because the model keeps nothing between messages and must be handed the full history every time.
How the numbers add up
The course measured a 40-turn customer support chat. The text of the whole conversation came to 5,090 tokens. The input billed across all 40 turns came to 112,617 tokens, about 22 times the length of the conversation itself.
It then fitted a simple curve with a squared term to those measurements. The curve predicted a running total of 113,645 tokens by turn 40, very close to the 112,617 actually measured. Most of that total comes from the squared part, which is the rereading of history. The part that grows in a straight line is what the user really typed.
In money, for the same 40 questions:
| How the questions were sent | Cost | |---|---| | Each one on its own, with no history | $0.066 | | Each one with the full history | $0.274 |
Keeping the history made the bill about 4.2 times bigger. And that multiplier is not fixed. It is driven by the length of the conversation, so a longer chat would multiply the bill even further.
Why it matters
The idea to take away: the bill follows the square of how long the conversation is, not the size of the latest question. If you estimate what a chatbot will cost by looking at how long typical questions are, you will guess far too low. What matters is how many turns people keep going, because each new turn pays again for all the earlier ones.
It also explains why a question that does not need the earlier conversation is so much cheaper when it is sent on its own. Providers offer ways to soften the rereading cost, such as prompt caching, which is a topic of its own.
Learn it step by step in Chapter 16 of our free course AI From Scratch: The Context Window, Tokens and the Bill, Measured.
рдЗрди рдкрд░ рднреА
рдЗрд╕ рдЕрдзреНрдпрд╛рдп рд╕реЗ рдФрд░
#214
рд╣рдорд╛рд░реЗ рдореБрдлреНрдд рдХреЛрд░реНрд╕ рдХреЗ рдЕрдзреНрдпрд╛рдп 16 рд╕реЗ AI рд╕рд╣рд╛рдпрддрд╛ рдХреЗ рд╕рд╛рде рд▓рд┐рдЦрд╛ рдЧрдпрд╛ рдЯреЗрдХреНрд╕реНрдЯред