The unit is a token, and the two sides are priced differently
- : the price per million input and output tokens.
Output is typically three to five times the price of input, because it is produced one sequential pass at a time while input is processed in one batch.
The per-request cost is never the interesting number. A tenth of a cent at ten thousand requests a day is three hundred dollars a month, and that is the number to optimise against.
Where the tokens actually are
In a retrieval application the retrieved context is usually most of the bill, and in an agent the accumulated history is.
Every agent step re-sends the whole conversation, so a twenty-step task costs on the order of four hundred single-step calls rather than twenty.
Truncating tool output before it enters the history is therefore the highest-value change in an agent, and it usually costs one line.
The four levers, in order of return
- Prompt caching, which cuts repeated prefixes to about a tenth of the input price.
- A smaller model for the requests that do not need the large one.
- Fewer retrieved chunks and shorter tool outputs.
- Batch processing for anything that is not interactive, often at half price.
The first is free in engineering terms as long as the prompt is ordered with the stable part first, and it is the one most systems leave on the table.
Routing, made concrete
- : the fraction handled by the small model alone.
If the router itself is a model call, its cost is paid on every request including the ones that escalate, which is why a classifier or a rule is often better than a model.
The saving is real and it is bounded by the escalation rate, so measuring honestly on production traffic comes before building the router.
What to measure
Measure cost per successful request.
Cost per call is the wrong denominator. A cheaper model that fails a fifth of the time and triggers a retry with a larger one is not cheaper.
Track it per user, per feature and per day.
Attributing spend to a feature is what makes the decision possible, and it needs the token counts logged with the request rather than reconstructed from a monthly invoice.
The last lever is the one people reach for first: changing provider.
It moves the constant and leaves the structure alone, and a system sending ten thousand redundant tokens per request will be expensive on any provider.