What will this actually cost to run, and where does the spend hide?
The per-token sticker price on a pricing page is not what an AI feature costs to run. Retries, fallbacks, context growth, and agent loops routinely push real production spend to 5-20x the naive estimate.
What happens at this stage#
Cost modeling for AI systems fails for one recurring reason. A per-token estimate prices one clean attempt at a task. Production never runs one clean attempt per outcome. It runs as many attempts as the task takes. Retries follow rate limits or malformed responses. Fallback calls go to a second, often pricier model when the first one fails. Agentic workflows chain several calls to reach one completed task. None of that shows up in "tokens per request times price per token". That is why the invoice is so often a multiple of the budget.
The fix is to measure and budget cost per successful outcome, not cost per call. Divide total spend for a feature by the count of tasks that actually completed, not the count of API calls made. Track the calls-to-completions ratio over time. It catches a cost regression at the same moment it catches a reliability regression, because the problem is usually the same. An unbounded retry policy or a stalling agent loop is a cost incident before anyone reports it as a quality one.
Model-agnostic routing is the most direct lever for controlling spend once volume is real. Send the easy, high-volume requests to a cheap, fast model. Reserve the expensive model for requests that need its extra capability. A model cascade tries the cheap model first. It escalates only on low confidence or failure. It routinely cuts spend a lot with no matching drop in quality. That holds only if you measure the routing logic and the confidence threshold. Do not set them once and forget them.
Prompt caching is the second lever, and it's the one teams most often leave on the table entirely by accident. Caching only pays off when the prefix of a request is byte-identical to a previous one. A single volatile token near the front busts the cache for the entire prefix. A timestamp, a per-request UUID or a reordered tool list can do it. The request still looks "basically the same" to a human reading it. The fix is pure ordering discipline: static instructions and tool definitions first, anything that changes per request last. Check your actual cache-read share against your provider's usage data. A broken cache is a pure cost and latency defect. It produces no other visible symptom.
CostMon exists because we hit this exact reconciliation problem running our own stack. AI, cloud and SaaS spend land across a dozen billing consoles. Each console has its own export format and its own definition of "usage". Reconciling that by hand every month is a manual process this studio would tell a client to stop doing. Whatever tooling you use, the discipline is the one CostMon makes self-serve. Engineering and finance should trust one normalised number. Check it against the modeled estimate on a schedule. Do not discover it as a surprise on the monthly invoice.
The common mistake#
The most common mistake at this stage is budgeting from the vendor's per-token price sheet and never revisiting it against actual billing data. The first real signal is a monthly invoice three times the estimate. By then the retries, fallbacks or loop that caused it are old news in the logs.
How do you know this stage is finished?#
- Cost is modeled and tracked per successful outcome, not per API call.
- The calls-to-completions ratio is tracked over time, alongside total spend.
- Easy, high-volume requests are routed to a cheaper model; the expensive model is reserved for what actually needs it.
- Prompt cache-read share is checked against provider usage data, not assumed from how the prompt looks.
- Actual billing is reconciled against the modeled estimate on a schedule, not discovered as a surprise.
What backs this up#
Insights
- AI Cost per Outcome in Production, by Workload
What cost per outcome actually looks like broken down by workload shape.
Case studies
- Cutting Inference Spend 40% Without Betting on One Vendor
The model-cascade lever above, applied to a real engagement.
Patterns
- Model cascade
The routing shape that sends easy requests to a cheap model automatically.
- Stable-prefix prompt caching
The ordering discipline that makes prompt-caching discounts actually land.
Failure modes
- Retry-amplified spend
Why the invoice runs 3x the estimate: the failure this stage's cost-per-outcome fix addresses.
- Prompt cache never hits
The specific, invisible way a caching discount silently never applies.
Glossary
- Inference Cost
The line item this entire stage is about keeping honest.
- Idempotency
What makes a retry on a write-scoped call safe instead of a second, silent mutation: the fix behind retry-amplified spend above.
Tools
- AI Cost Calculator
Model your own volume and failure rate instead of trusting the sticker price.
More
- CostMon
The billing-reconciliation problem this stage describes, built as the product answer to it.
- The AI Cost Model
The full pillar behind this stage: six cost surfaces, 24 named levers, five ways a cost estimate lies, and the scoreboard.
Questions on this stage#
What comes up before and during cost.
01 Why is our inference bill so much higher than we estimated?
The estimate almost certainly priced one clean call per outcome. Production runs retries, fallbacks, and (for agents) several chained calls per completed task, none of which show up in a simple tokens-times-price model. Measure cost per successful outcome, not per call, to find where it's actually going.
Link to this answer: Why is our inference bill so much higher than we estimated?02 What's the fastest lever for cutting AI spend?
Model-agnostic routing: send easy, high-volume requests to a cheap model and reserve the expensive one for what genuinely needs it. A model cascade tries the cheap model first. It escalates only on low confidence or failure. It routinely cuts spend a lot with no matching drop in quality. That holds only if you measure the routing logic and the confidence threshold. Do not set them once and forget them.
Link to this answer: What's the fastest lever for cutting AI spend?03 Why aren't we getting prompt-caching discounts?
Something volatile is almost certainly near the front of the prompt and busting the cache on every call. A timestamp, a request ID or a reordered tool list are the usual suspects. Caching only works on a byte-identical prefix; put static content first and anything that changes per request last.
Link to this answer: Why aren't we getting prompt-caching discounts?A Ship Audit checks your actual system against every stage of this handbook and hands back a written, prioritized plan.