Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

OpenRouter measures how to cut AI agent token costs

AI summary

OpenRouter replayed one 40-step synthetic coding session through its API under six context configurations, measuring token use, cache hits, cost and accuracy. A timestamp at the start of the system prompt broke prompt caching and raised the session cost from $0.084 to $0.658, while capping tool results once produced the cheapest setup at $0.054. OpenRouter recommends keeping the prompt prefix unchanged, using a constant session_id and compacting long sessions without summarizing earlier summaries.

In-depth insight

The measurements show that preserving an identical cached prefix can matter more than reducing raw token volume, but the findings come from one synthetic session on one model with one provider's caching setup.

How to Reduce Token Usage in AI Agents (Measured)

OpenRouter ·12/1/2026

How to Reduce Token Usage in AI Agents (Measured)
How to Reduce Token Usage in AI Agents (Measured)

An AI agent resends its whole conversation to the model on every step, so a long session’s token count and its bill grow with every call. This guide shows you how to bring both down, using measurements instead of guesswork.

We replayed one 40-step coding session through the OpenRouter API under six context setups, including one failed first attempt at compaction, and measured the tokens, cache hits, cost and accuracy of each. The most expensive run sent exactly the same tokens as a much cheaper one, and the difference came down to one line in the system prompt.

#OpenRouter#OpenAI#GPT-6 Luna

Original · 10 min readRead the original
Group chat

No comments yet. Start the conversation.