AI in production
How to reduce AI infrastructure cost in production
Every cost change is a behavior change. Prove it before you ship it.
In brief
You can reduce AI infrastructure cost in production substantially without changing what users see, because the spend sits in a few habits: oversized context, one premium model for every task, no caching, real-time calls for work that could wait, and inference far from its data. Measure cost per tenant, feature and outcome first, then work the levers in that order, and rerun your evaluation set after each change.
On this page
- 01Measure AI infrastructure cost per tenant, feature and outcome
- 02The levers, in order of payback
- 03Context discipline and prompt caching
- 04Model routing: the cheapest model that passes your evals
- 05Batch, flex and placement
- 06Self-hosted models and accelerator utilization
- 07Do not trade correctness for cost silently
- 08What we see in production
- Frequently asked questions
01Measure AI infrastructure cost per tenant, feature and outcome
Before cutting anything, attribute every model call. Each call should carry the tenant, the feature, the model, input tokens, cached tokens, output tokens, latency and whether the user outcome succeeded. Without that record you cannot tell an expensive feature from an expensive customer, and you will cut the wrong thing. This is part of our larger guide, LLMOps for SaaS: keep AI features working in production.
The vendors already return most of what you need. Amazon Bedrock, for example, reports cache reads and cache writes separately in every response, and its documentation notes that once caching is on, the plain input token count covers only uncached tokens. If your cost dashboard reads only that one field, it will understate usage and overstate savings. Log all three numbers and add them up yourself.
Then compute one metric per feature: cost per successful action. Failed attempts, retries and guardrail checks all count against it. This is the number that tells you whether a lever worked, and it is the one we come back to in how much production AI costs in SaaS.
02The levers, in order of payback
These are the levers we work, ordered by how much they usually save against how much product risk they carry.

| Lever | What it changes | Effort | Risk to answer quality |
|---|---|---|---|
| Context discipline | Fewer input tokens per call through tighter retrieval and trimmed instructions | Low | Low, if evaluated |
| Prompt caching | Repeated instructions, tools and reference text billed at the cache rate | Low | None |
| Model routing | A cheaper model for easy steps, the premium model only where it wins | Low to medium | Medium, needs evals |
| Batch and flex tiers | Work that can wait moves off the real-time price | Medium | None |
| Placement | Inference runs in the same cloud and region as its data | Medium | None |
| Self-hosted capacity | Open-weight models on your own accelerators | High | Medium to high |
The first two are almost always worth doing first. They need no change to the user experience and little change to the code.
03Context discipline and prompt caching
Input tokens are usually the largest part of the bill for retrieval-heavy features, because each call carries instructions, tool definitions, retrieved records and conversation history. Most of that is either repeated on every call or not needed at all.
Start by cutting what is not needed. Retrieve fewer, better chunks. Filter by tenant, date and record type before ranking, not after. Summarize long conversation history instead of resending it. Remove tool definitions the current step cannot use.
Then cache what repeats. Anthropic bills a cache hit at 10 percent of the normal input price on most Claude models, and at 5 percent on Claude Opus 5.5 and Claude Sonnet 5.5. A five-minute cache write costs 1.25 times the input price, so Anthropic notes that caching pays off after a single cache read. AWS describes prompt caching on Bedrock as a way to reduce both latency and input token cost for prompts with long, repeated context.
Caching only pays when the prompt is built for it. Three rules from the Bedrock documentation decide your hit rate:
- A cache checkpoint needs a minimum prompt prefix, currently between 512 and 4,096 tokens depending on the model. Shorter prefixes are simply not cached.
- Bedrock reads checkpoints in the order tools, then system, then messages. Changing an earlier section invalidates the cache for everything after it, so put stable content first and anything that changes per request last.
- Most cache entries live for five minutes, and the timer resets on each hit. Some Claude models also support a one-hour cache for traffic that arrives less often.
A practical test: if your system prompt contains the current time, the user's name or a request ID near the top, your cache hit rate is probably close to zero. Move those to the end.
04Model routing: the cheapest model that passes your evals
Model tiers are priced far apart. On Anthropic's published price list, Claude Haiku 5.5 input costs one twentieth of Claude Sonnet 5.5 input for prompts up to 100,000 tokens. Classifying a request, extracting fields, choosing a tool or checking a format rarely needs the premium tier. Writing a careful answer from conflicting records often does.

Route by task, not by user. Split the feature into steps, run each step on your evaluation set with two or three models, and assign each step the cheapest model that passes. Keep the result in configuration, not in code, so you can change it when prices or models change.
Managed routing exists too. Amazon Bedrock offers Intelligent Prompt Routing, billed per request, and AWS states it can reduce costs by up to 30 percent without compromising accuracy. Treat that as a claim to test on your own cases. A router you did not tune to your data can still pick the wrong model for your hardest step.
Build the routing behind a model-agnostic layer inside your product, with provider-independent prompts and typed tools. That layer is what lets you act on a better price next quarter without touching product code.
05Batch, flex and placement
Not every AI task needs an answer in two seconds. Nightly summaries, backfills, document classification, evaluation runs and report drafts can wait minutes or hours. Anthropic, OpenAI and Google all price batch processing at half the standard rate, and Amazon Bedrock prices batch inference for select models 50 percent below on-demand. Bedrock also offers a Flex tier at a 50 percent discount to Standard, and a Priority tier at a 75 percent premium for traffic that must not wait. Pick the tier per workload.
Placement is the quiet lever. A model call in a different region or cloud from the data it reads pays transfer charges on every retrieval, and it adds latency. Keep inference next to the data. Where you use cross-region routing for capacity, choose deliberately: on Bedrock, a global cross-Region inference profile is priced about 10 percent below a geographic one, while a geographic profile keeps processing inside a boundary such as the United States. If your customers' contracts require U.S. processing, that boundary is worth more than the discount. Anthropic's own API applies a 1.1x multiplier when you require U.S.-only inference, so data residency has a price on every platform and belongs in the cost model.
06Self-hosted models and accelerator utilization
Open-weight models on your own accelerators can beat managed pricing when traffic is high and steady. They lose at spiky or low volume, because you pay for the hardware while it waits. Before committing, model both options against your real traffic curve, hour by hour, and include the engineers who will run the serving stack, patch it and handle capacity at peak.
If you do self-host, utilization is the metric that matters. Autoscale to zero where the workload allows it, batch requests on the server side, choose the smallest accelerator that meets your latency target, and buy committed capacity only for the base load you can prove.
07Do not trade correctness for cost silently
A cheaper answer that is wrong more often is a support cost, not a saving. Run every cost change through the same procedure:
- 01
Record the baseline
cost per successful action, quality score, latency and failure rate on your evaluation set.
- 02
Make one change at a time
a context cut, a cache checkpoint, a routing rule or a tier change.
- 03
Rerun the full evaluation set and compare every metric, not only cost.
- 04
Ship behind a feature flag to a share of tenants, and watch the production numbers per tenant.
- 05
Keep the change only if quality holds, and store the before and after results next to the saving.
This is slower than flipping a model name in a config file. It is also the only way to know that the saving is real and that nothing your customers rely on got worse. We cover why production failures are rarely about model intelligence in why AI agents fail in production.
08What we see in production
We treat inference economics as cost per successful task, and we measure it before we change anything. The most common finding is that cost comes from how the product calls the model, not from the model itself. The model is rarely where the money goes. The calls the product makes, what it sends each time and what it repeats are.
When we test an AI feature a team has already built, in staging, we grade cost per user alongside answer quality, grounding, data separation, misuse resistance and response time, on 50 of the product's own cases. Those cases stay with the team and rerun on every release, which is what makes later cost cuts safe to ship.
We run the AI in the customer's own cloud, on the model they choose, by default, across AWS, Azure and Google Cloud. That keeps inference next to the data and inside security boundaries the customer has already approved, including VPC and self-hosted deployments where the data requires them. On one analytics sync, in the client's own Google Cloud project, we replaced a job that loaded and compared the full dataset on every run with a batched flow that reads only rows newer than the destination already holds. First sync and catch up run on the same path, so memory use and run time no longer grow with the history.
Frequently asked questions
What is the fastest way to cut AI infrastructure cost?
Trim the context and turn on prompt caching for the parts of the prompt that repeat. Both need little code, do not change what users see, and work on any major platform. Measure cost per successful action before and after so you know the size of the saving.
Does switching to a cheaper model hurt quality?
It can. Test each step of the feature on your own evaluation set with the cheaper model first. Many steps pass, such as classification and extraction; some do not. Route only the steps that pass, and keep the premium model where it measurably wins.
When does self-hosting an open-weight model make sense?
When traffic is high and steady enough to keep accelerators busy, and you have engineers to run the serving stack. For spiky or modest traffic, managed pricing with caching, routing and batch processing is usually cheaper once people cost is counted.
How Datics helps
Datics specializes in Brownfield AI: production AI inside software people already rely on. Once your AI is live, AI Care re-tests it every month on your own cases and keeps it accurate and affordable, for $1,500 a month per capability. Not sure it is ready? The AI Scorecard tests it on 50 of your own cases in two weeks, for $5,000.
›References (6)
Related work
Case studies from our projects on the same subject.
Insurance Sales Lab
EdTech · Desktop call recorder
Real sales calls recorded from any meeting tool, never cutting the agent off
Real calls went unscored because agents use many meeting tools. Now one signed desktop app records both sides, and AI scores the call.
SovrenAI
Legal Tech · TITO, an AI claim verification engine
Every verdict traces to the founder's own rules, with the model only suggesting
A founder's AI-coded prototype could not be measured or audited; now rules anchor every verdict and each answer shows how it was reached.
NenoDoc Lexicon by Neno Technologies
GovTech · Archive knowledge workspace
Archive indexers fix grammar and style without a name, date or figure changing
AI rewrites can quietly alter names and numbers. Ours edits only flagged spans, and approved terms are locked before the model sees them.
More on AI in production
AI in production
LLMOps for SaaS: keep AI features working in production
LLMOps for product teams: evaluation gates, prompt and model versioning, tracing, regression checks, cost per task, kill switches and model upgrades.
AI in production
AI development cost: what production AI costs in SaaS
AI development cost in a live SaaS product: inference, retrieval, data movement and engineering, with bands built from published model prices.
AI in production
AI token cost: forecast LLM spend as usage grows
AI token cost grows with every customer. Measure it per feature, tenant and successful task, cut it with architecture choices, and forecast it as usage grows.
AI in production
AWS Bedrock vs Azure OpenAI vs Vertex AI for existing SaaS
AWS Bedrock vs Azure OpenAI in Microsoft Foundry vs Google Vertex AI: how to choose a managed AI platform for a SaaS product already in production.
AI in production
AI agent monitoring: catch regressions in production
AI agent monitoring for live SaaS products: what to trace on every run, which user signals to watch, how to score traces and when to roll a change back.
AI in production
Which AI pricing model works when every answer costs money?
Build an AI pricing model from cost per action: decide which plans trigger expensive AI work and how often, then enforce limits on the server.
Your customers already expect AI from your product.
Let us make it real inside the product you run today.
