GuidesCalculator

AI chatbot conversation cost calculator

By the Banzai Labs teamUpdated on 2 min read

Turn 1Turn 2Turn 3Turn 4Turn 5History re-readMessageAnswerEach turn re-reads everything before it
On every turn, the whole conversation is re-read: cost climbs faster than the number of messages.

The calculator

Tokens read per conversation
—
Tokens written per conversation
—
Cost of one conversation
—
Cost per month
—

The starting prices are an example: replace them with your provider’s.

The calculation

At turn n, the model reads the system prompt, the n − 1 previous exchanges and the new message. We add this up over all turns, then apply the input and output prices.

Three levers

  1. 1SummariseAfter a few turns, the history becomes a short summary.
  2. 2CacheThe system prompt, identical at every turn, costs less when cached.
  3. 3ShortenBrief answers: output is the most expensive part.

For a single call: the token calculator. To understand why: the context window.

Frequently asked questions

Why does the cost climb so fast?
The tenth message makes the model re-read the nine before it and their answers. The volume read grows roughly with the square of the number of turns.
How can I reduce the cost?
Summarise the history after a few turns, cache the system prompt, and limit answer length.
Are my figures sent anywhere?
No. The calculation runs in your browser.

Read next

All guides