What is a Context Window?
A context window is the number of tokens a model processes per call — system prompt, history, and tool outputs. It's also the biggest lever on LLM cost.
How context drives cost
Input tokens are billed per token; a 100K-token context costs ~100× a 1K one.
Agent tool outputs and conversation history pile into context every turn.
The optimization
Trim tool outputs, summarize history, cache stable prefixes.
Cap per-call spend so one oversized context can't blow the budget.
FAQ
Why is context the most expensive shape?
Because it scales linearly with tokens, and agents re-send the same context repeatedly.
How do I control it?
Context trimming, caching, and a per-transaction cap on inference calls.
Related
Stop the next $12,400 night.
One API call (or MCP tool) in front of every agent transaction — APPROVED, BLOCKED, or FLAGGED, deterministic, ~5 ms, fully logged.
See plans — from $99/mo Try a live check