Where Is Your AI Bill Actually Leaking?
Your prototype cost pennies; your production bill doesn't. A practical order of operations for small teams to control AI costs.
Almost every team that ships an AI feature hits the same moment. During the build it costs a few dollars a day; two months after launch, the invoice has an extra digit. Usually it isn't a traffic spike. It's structure, not volume — the same work burning several times the tokens it needs to, with nobody watching.
Model prices keep falling. So why do bills keep rising? Because as prices fall we ask models more often, with longer inputs, in more steps. Agents and background automation widen that gap. And if you set a price without knowing your unit cost, the better your product sells, the more money you lose.
Why do AI bills grow faster than usage?
Most overspend comes from quiet repetition, not from customers. One user request fans out into several model calls, and each call re-sends the same instructions and documents in full. If you have an AI feature in production, two or three of the items below are almost certainly in your codebase already.
- Conversation buildup: every turn re-sends the whole history, so input tokens snowball as chats get long
- Dumping instead of retrieving: pasting the entire manual or product catalog when three paragraphs would do
- Invisible retries: malformed output or timeouts trigger automatic retries that show up in error logs but never in cost logs
- Agent loops: each tool call replays the full context, so a five-step task can cost many times a single call
- Overpowered models: using a frontier model for classification, tagging, and short summaries
- Unguarded demos: a public playground with no login eventually meets a script
What should you fix first?
Order matters. Optimizing before measuring usually degrades quality without moving the bill. Work through measure → cache → route → trim, and you can clear most of the waste without restructuring your app.
- Log every call: which feature, which model, input and output tokens. Once you have a cost-per-feature table, the culprit is usually one or two endpoints.
- Turn on prompt caching: system instructions, brand guidelines, and policy documents are identical on every call. OpenAI, Anthropic, and Google all price cached input lower — putting the fixed block first and the variable part last is often the whole change.
- Route by difficulty: small model by default, escalate only hard cases. Classify support tickets and answer routine ones with a small model; send refunds and complaints to the larger one.
- Trim context: top 3–5 retrieved passages instead of whole documents; recent turns plus a rolling summary instead of full history.
- Cap output: set max tokens and request structured JSON. That's far more reliable than asking the model to "be brief."
- Batch what isn't urgent: bulk product descriptions or review tagging can run through batch APIs at a lower rate.
Example: a support bot's cost cleanup
Imagine a small store's support bot that sends the full shipping-and-returns policy plus the entire chat history with every question. Move the policy into a cached fixed block, keep only the last six turns, and route simple delivery lookups to a small model. That's half a day of work — and a visibly different invoice. The one rule: freeze answer quality with a small eval set before you change anything.
What guardrails keep a bad day from becoming a bad month?
Optimization lowers your average; guardrails cap your worst day. They are different jobs and you need both. If you run anything agent-like that can loop on its own, set limits before you optimize.
- Per-user and per-workspace daily caps, with a clear message when they're hit
- Max steps and timeouts for agents — a single runaway loop can eat a month's budget
- Budget alerts in the provider console, wired to a phone someone actually checks
- Public demos behind login or rate limits
- Pricing that reflects cost: credits or usage tiers instead of unlimited, heavy features on higher plans
AI spend behaves less like hosting and more like cost of goods. Only a team that knows what one use costs can price the product properly. If you do one thing this week, make it a per-feature token log. The table will make the rest of the decisions for you.