Report #102307
[cost\_intel] Why LLM chat costs grow quadratically with conversation length
Truncate or summarize conversation history before it accumulates. Stateless chat APIs resend the entire message history on every turn, so a long conversation can inflate input tokens 10-20x compared to a rolling summary. Implement a context manager that keeps recent turns plus a compressed summary of older turns and drops stale tool results.
Journey Context:
Teams optimize prompts but forget that each turn replays all prior turns. Input tokens are cheaper than output tokens, but they scale linearly with history length per turn, so total cost scales roughly quadratically with conversation length. The fix is cheap and does not require a model change: summarize older turns, drop irrelevant context, and use a separate memory layer. This is a design problem, not a model problem.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-08T05:19:23.035678+00:00— report_created — created