The arithmetic of LLM cost is simple. BigData Boutique's production playbook states it directly: cost equals input tokens plus output tokens, multiplied by the per-token price of the model you called (BigData Boutique, LLM cost optimization techniques). Every cost lever pushes on one of those terms.
What makes bills grow is not usually one expensive model. It is compounding waste. The same playbook lists the usual suspects: a system prompt that ships with every request, an agent loop that retries several times before giving up, a retrieval step that stuffs a large block of context into the prompt to answer a one-line question, and a frontier model doing work a small one could handle. It groups the hidden spend into four places: retries, long context, verbose output and over-large models.
Agents make this worse. Morph's guide to cost optimization explains why: an agent makes many calls per task, and each call re-sends the full conversation history, so early messages are paid for again on every later turn. A token wasted on turn one of a 30-turn session is paid for 30 times (Morph, LLM cost optimization). Context growth is often the largest line in an agent's bill.
| Where cost hides | What it looks like |
|---|---|
| Repeated context | Long system prompts and full history re-sent on every call |
| Retrieval bloat | Many chunks stuffed into the prompt when two would do |
| Verbose output | No output cap, prose where structured data would do |
| Over-sized models | A frontier model doing classification or formatting |
| Retries and loops | Failed tool calls and agent loops that re-run the model |



