Skip to main content
D squared Enterprise Advisory

Cloud

AI cost management as an architecture concern

Token spend, inference infrastructure and data movement costs are architectural decisions. Treating them that way keeps AI economics predictable.

Denys Dyeyev · · 5 min read

The first significant AI invoice usually arrives as a surprise. Not because anyone was careless, but because nobody could have predicted it. The pilot cost a rounding error. Production costs a line item that finance now wants explained, and the team explaining it often cannot say which decisions produced the number.

AI spend behaves differently from most infrastructure cost. It scales with usage in ways that are hard to intuit, and it is determined largely by decisions taken months earlier at design time. By the point the invoice is legible, the expensive choices are already deployed.

The expensive choices are made at design time, long before the invoice is legible.

Cost is a design-time decision

Consider a retrieval-based assistant. How much context is sent with each request. How aggressively results are cached. Whether every query goes to the largest available model or is routed by difficulty. How often the knowledge base is re-indexed. Where the data physically sits relative to the compute. Each is an architectural decision, and together they can produce an order of magnitude difference in monthly cost for a system that behaves almost identically to the person using it.

  • Model routingSend only the hard requests to the largest model
  • Context sizeRetrieve what the task needs, not everything available
  • CachingReuse answers to repeated and near-identical questions
  • Data localityKeep data and compute in the same place

Each is decided during design. Retrofitting any of them usually means rebuilding the request path.

Four architectural decisions account for most of the variance in what an AI system costs to run.

The decisions that actually move the number

Three tend to dominate. The first is model routing: sending every request to the most capable model is the simplest design and usually the most expensive, when a large share of traffic would be served just as well by something smaller. The second is context discipline, because retrieving and sending more than the task requires is invisible in testing and costly at volume. The third is caching, which is frequently omitted altogether since it was unnecessary at pilot scale.

None of these are optimizations to apply later. They are structural, and retrofitting them usually means rebuilding the request path.

The techniques worth knowing

A handful of well-established techniques account for most of the achievable savings, and all of them are easier to build in than to add afterwards. Model tiering routes requests to the smallest model that handles them acceptably, with escalation to a larger one when confidence is low. Semantic caching recognizes that a new question is close enough to one already answered and reuses the result, which matters because production traffic repeats far more than pilot traffic suggests. Prompt compression trims instructions and retrieved context down to what the task genuinely needs. Where models are self-hosted, quantization reduces the precision of model weights to cut inference cost, usually with modest quality impact on narrow tasks.

An AI gateway sitting in front of these choices is what makes them changeable. Without one, routing and caching decisions are scattered through application code and every adjustment is a deployment. With one, they become configuration, and the team can respond to a cost surprise in hours rather than in a sprint.

Routing and caching belong in a gateway, not scattered through application code where every change is a deployment.

Make cost observable before you make it optimal

Teams often jump to reducing cost before they are able to see it. The more useful first step is attribution: cost per feature, per tenant, per request type. Until spend can be traced to something a business person recognizes, every conversation about it is speculative, and the usual outcome is a blunt decision to limit usage.

Attribution also changes the conversation from cost to value. A feature costing a meaningful amount each month is a problem in isolation and a bargain if it replaces hours of manual work. Neither judgement is available without the numbers.

Governing spend without blocking work

Budgets and alerts belong in the architecture rather than in a monthly review. Set an expected cost envelope per use case at design time, instrument against it, and alert when reality diverges. Treat a sustained overrun the way you would treat a performance regression: something to investigate, not something to absorb quietly.

The metric that matters is cost per task

Total spend is the least useful number available. It rises when adoption rises, which means it cannot distinguish success from waste. The metric worth building toward is cost per completed task: per document processed, per conversation resolved, per report generated. That number can be compared against the manual alternative, tracked over time, and defended in a budget conversation.

It also changes behaviour. A team watching total spend optimizes by using the system less. A team watching cost per task optimizes by making the system better, which is the outcome you actually wanted.

This is why FinOps practice is extending into AI rather than treating it as ordinary cloud spend. The cost drivers are different, they are set earlier, and they are far more sensitive to design decisions than to infrastructure tuning.

AI economics are not inherently unpredictable. They are predictable for organizations that treat them as an architectural property rather than an operational surprise, and that decide the cost profile at the same time they decide everything else about the system.

Key takeaways

  • AI cost is set at design time by model routing, context size, caching and data locality.
  • Sending every request to the largest model is the simplest design and usually the most expensive.
  • Attribute spend to features and tenants before attempting to reduce it.
  • Set a cost envelope per use case and alert on divergence, as you would for a performance regression.

Discuss how this applies to your organization.