Skip to content
OpenRouter Announcements·· 1 d agoPicksAI score78

OpenRouter measures how to cut AI agent token usage across six context setups

How to Reduce Token Usage in AI Agents (Measured)

AI summary

OpenRouter replayed one 40-step coding session through its API under six context setups to measure tokens, cache hits, cost and accuracy. A timestamp at the top of the system prompt broke prompt caching and made the same session cost 7.8 times more ($0.658 vs $0.084), while capping each tool result once when it enters history was cheapest at $0.054 with input down 36% and 95% still cached. Re-trimming old tool outputs on every step cut input tokens by 60% but cost 3.1 times more, and re-summarizing an earlier summary dropped accuracy to 1 of 4.

Why it matters

A measured 40-step agent replay shows how a timestamp in the system prompt or re-trimming old tool outputs breaks prompt caching and multiplies cost, with concrete fixes.

Source:OpenRouter Announcements · openrouter.ai

OpenRouterAI agentsDeployment engineeringTutorials