What “full context every turn” means
A common agent loop keeps the system prompt, tools, and the entire transcript in the request. Turn 1 is cheap. Turn 20 re-pays for turns 1–19 again. That is useful for continuity — and expensive when sessions are long or frequent.
Why cost grows faster than “tokens × turns”
For a fixed prefix P, user message size U, assistant reply size A, and T turns, total input tokens are approximately:
Σ I_t = T·P + T·U + (U+A)·T(T−1)/2
Output is closer to linear (T·A). The triangle term is why “we only added a few turns” can still blow the input bill.
Worked example (illustrative assumptions)
Labeled scenario — not customer data: 200 sessions/day × 20 turns, with P=2500, U=150, A=300.
- Per session ≈ 138.5k input / 6k output tokens
- Monthly (30 days) ≈ 831M input / 36M output
- Same workload retrieving R=1500 tokens per turn instead of dumping history ≈ 498M input (same output) — derived from the same P/U assumptions plus R, not a hard-coded monthly total
| Turn | Cumulative input tokens | vs turn 1 |
|---|---|---|
| 1 | 2,650 | 1.0× |
| 5 | 17,750 | 6.7× |
| 10 | 46,750 | 17.6× |
| 20 | 138,500 | 52.3× |
| Model (catalog snapshot) | Full-context / mo | Retrieved-context / mo |
|---|---|---|
| GPT-4o mini $0.15/M in · $0.6/M out | $146 | $96.3 |
| Claude Sonnet 4 $3/M in · $15/M out | $3,033 | $2,034 |
Dollar columns use a catalog snapshot as of 2026-09-23. Prices move — re-check on the calculator before you publish a budget.
Levers that usually move the bill
- Trim or summarize older turns instead of re-sending them verbatim.
- Use provider prompt caching when the prefix is stable.
- Pick a cheaper input $/M model when quality still holds — compare on /compare.
- Retrieve only what the next turn needs instead of dumping the transcript.
- Scan /cheapest-llm-api and /models when input-heavy workloads dominate.
Soft context: interaction-scoped memory (for example the Mem0 paper on Memory Papers) is one way teams avoid full-transcript dumps — this guide stays on cost math.
Run your numbers
- Open /calculator and enter your input/output tokens per session (or per day).
- Compare two models on /compare when you are choosing a cheaper input tier.
- Use /cheapest-llm-api for a ranked shortlist, then confirm on the model pages under /models.