AI Tools

Agent Context & Cost Calculator

Most agent APIs have no memory: every turn resends the whole conversation so far. See how many tokens that adds up to over a session, compare ways to trim it, and estimate cost with a rate you supply.

Describe a typical turn

Runs locally in your browser. Nothing you type here is uploaded, saved, or shared.
One typical turn
Session and trimming
Session

Describe a turn to see how context grows.

Ready when you are.

Watch: estimate context growth

No sound. Each step is captioned on screen and also written out in the guide below.

See the growth in three steps

  1. 01
    Describe one turn

    Paste real examples: a system prompt, a user message, a reply, a tool result.

  2. 02
    Set the session length

    How many turns, and how much history you'd keep.

  3. 03
    Compare strategies

    See the total tokens sent, and what each turn costs by the end of a long session.

Why context grows

  • Stateless APIs: OpenAI, Claude, and Gemini don't remember past turns. Your code resends them every time.
  • Tool calls add up fast: each tool call and its result is added to the history that gets resent on every later turn too.
  • Trimming has trade-offs: a sliding window forgets old context completely; a summary keeps a compressed memory of it, at a small fixed cost per turn.

No prices are built into this page: you enter your own rate, so the numbers never go stale.

Frequently asked questions

Why doesn't this use real pricing?

Rates differ by provider, model, and change over time, and this site doesn't call any API to look them up. Enter your own current rate, and the dollar figures stay accurate for as long as that rate is.

What does the cache discount really assume?

That every token except the newest turn's new content hits an exact cache match. Real prompt caching requires the repeated prefix to match exactly and expires after a few minutes of inactivity, so treat this as a best case, not a quote.

Which strategy should I use?

It depends on the task. A sliding window is simplest and fine when old turns stop mattering. A summary keeps the gist of earlier turns for a small, steady cost. Resending everything is simplest to build but gets expensive fast in a long session.

Is my data uploaded?

No. Counting tokens and running the simulation both happen in your browser.