AI Calculator Pro

Chat History Token Growth Calculator

See how resending chat history inflates tokens and cost.

Quick answer

With the default inputs, 70,300 tokens sent by message 20 — Full history costs $0.0135/session · a 6-turn window costs $0.00904. Enter your own numbers below to recompute instantly; the full step-by-step math is shown under the worked example.

Results update automatically as you type.

Result
70,300 tokens sent by message 20
Full history costs $0.0135/session · a 6-turn window costs $0.00904
Total input tokens (full history)
70,300 tokens
Session cost — full history
$0.0135
Session cost — 6-turn window
$0.00904
Saved by windowing
$0.00450

In a chatbot, every turn usually resends the whole conversation — so cost grows with each message. See how many tokens you're sending by the last message and how much a sliding window would save.

How this is calculated

Because each turn usually resends the whole conversation, input tokens grow message by message. We sum the tokens sent across the session — system prompt + all prior turns + the new message at each step — so you see the total by the last message, and compare it to a sliding window that keeps only recent turns.

Is this a good result? What to do next

If your by-the-last-message token count is many times the first message, unbounded history is quietly inflating cost and latency. A sliding window or periodic summary usually removes most of that growth with little quality loss on typical chat.

Typical planning ranges

Full-history cost growth
roughly quadratic in message count
Sliding window
bounds tokens to the last N turns
System prompt
re-sent every turn unless cached

Ranges are typical planning figures to sanity-check your result, not authoritative benchmarks. Your numbers will vary with use case, volume, and vendor.

How to improve this number

  • Use a sliding window of recent turns instead of full history.
  • Summarize older turns to compress the carried context.
  • Cache the system prompt so it isn't re-billed each turn.

Common mistakes

  • Costing one message and multiplying by message count.
  • Leaving history unbounded on long sessions.

When to use a different approach

For a full monthly chatbot bill, use the chatbot cost calculator. To quantify summarization savings, use the summarization savings calculator.

Worked example (defaults)

With the default inputs above, here is the result:

Result
70,300 tokens sent by message 20
Full history costs $0.0135/session · a 6-turn window costs $0.00904
Total input tokens (full history)
70,300 tokens
Session cost — full history
$0.0135
Session cost — 6-turn window
$0.00904
Saved by windowing
$0.00450
  • Resending full history each turn grows cost quadratically with message count.

Sources & references

Frequently asked questions

Why does chat cost grow over time?+

Each new turn typically includes the full prior conversation as input, so input tokens (and cost) grow with every message.

How do I control it?+

Use a sliding window of recent turns, summarize old history, or cache the system prompt.

Related calculators

Answering a real question?

This calculator powers these problem-solving guides: