The feature shipped on a Tuesday and the invoice arrived five weeks later. A product team had moved their document assistant from a hosted model API to models running on their own GPUs, because a spreadsheet said it would be cheaper at their volume. The spreadsheet was not wrong about the price of a GPU hour. It was wrong about everything around it. Nobody had planned the AI inference infrastructure, only the model, and the first month's bill for eight accelerators running around the clock was higher than the API bill it replaced.
When we looked at the dashboards the cause took about ten minutes to find. Average utilisation across the fleet was eleven percent. The team had sized for the busiest hour of the busiest day, kept that capacity warm all night and all weekend because a cold model took four minutes to load, and served each request on its own with no batching. They were paying for a factory and running it as a workshop. Latency was also worse than before, because at peak the queue backed up behind long generations and there was no admission control to shed load.
Nothing in that story is about model quality. The model was fine. It is a story about infrastructure, and it is the one we hear most often now that serving models has become an ordinary production workload. This article is the playbook we use when we design AI inference infrastructure for clients: when to call an API and when to host, how GPU capacity really behaves, what Kubernetes does and does not solve, and how to read the cost model before it reads you.
Why AI inference infrastructure is not like training or web hosting
Most intuition about GPUs comes from training, where a job starts, saturates the hardware for hours, and ends. Inference is the opposite shape. Requests arrive when users feel like sending them, each one is small, and the hardware sits idle between them unless you work hard to prevent it. The engineering problem in training is throughput. The engineering problem in inference is matching expensive, slow to start capacity to demand that is spiky and impatient.
It is also unlike the web services your platform already runs. A typical application server starts in seconds, uses memory in proportion to load, and can be packed densely onto shared machines. A model server takes minutes to become ready because it must pull tens of gigabytes of weights and load them into accelerator memory. It reserves that memory whether or not a request is in flight. And the unit it runs on, a GPU, is by default handed whole to one process. Every habit that makes ordinary autoscaling work is weaker here.
Two metrics describe whether an inference service is healthy, and they pull against each other. Users feel latency: how long until the first token appears and how fast the rest follows. Finance feels throughput per GPU: how many tokens or requests each paid hour produces. Almost every decision in this article is a trade between those two, and the craft is finding the configuration where both are acceptable.
API or self hosted: the decision most teams get backwards
The first infrastructure decision is whether to have infrastructure at all. Teams tend to frame it as a price comparison between a token rate and a GPU hour. That framing produces the story at the top of this article. The honest comparison has five dimensions, and price per unit is only one of them.
When a hosted API is the right answer
Call an API when volume is low or unpredictable, when you need the strongest available model, when the team has no one who has operated accelerators before, or when the feature is still finding its shape. A provider absorbs the idle time, the capacity planning, the upgrades, and the hardware failures, and spreads them across thousands of customers. You pay a premium per token and receive, in exchange, a utilisation rate you could never achieve alone. For a large share of products, that is simply the cheaper and safer arrangement, and it stays that way for years.
When hosting your own model earns its keep
Self hosting starts to make sense under specific conditions. Volume is high and steady enough to keep hardware busy most of the day. A smaller open weight or fine tuned model is good enough for the task, so you are not trying to replicate a frontier system. Data cannot leave an environment you control, for residency or contractual reasons. Latency requirements are tight enough that a network hop to a shared service is a problem. Or you need behaviour that will not change underneath you when a provider updates a model. One of these is a reason to investigate. Two or three together is usually a reason to build.
The middle options people forget
Between a shared API and your own fleet sit several arrangements worth pricing. Dedicated capacity from a model provider gives predictable throughput without operating anything. Managed inference endpoints on a cloud platform host an open model for you and bill by the hour. Serverless GPU platforms scale to zero and charge by the second, at a higher rate, which suits spiky and batch workloads. Many good architectures are hybrids: a self hosted small model for the bulk of simple requests, with an API for the difficult minority and as overflow at peak.
“A GPU you own is only cheaper than an API if you keep it busy. An idle accelerator is the most expensive way ever invented to do nothing.”
Utilisation is the whole game
If you take one idea from this article, take this one. The cost of self hosted inference is the price of a GPU hour divided by the useful work done in that hour. The numerator is set by the market and you can negotiate it by perhaps a third. The denominator is set by your engineering and can vary by a factor of ten. Teams spend weeks choosing an instance type and no time at all on the thing that decides the outcome.
Consider the arithmetic in plain terms. A fleet that averages fifteen percent utilisation pays roughly six times more per token than the same fleet at ninety. No discount programme closes a gap like that. In our experience a first deployment that has not been tuned lands somewhere between ten and twenty five percent, and a mature one sustains fifty to seventy during business hours. The distance between those two is where the business case lives or dies.
Utilisation is lost in three places. Capacity is provisioned for a peak that lasts an hour a day. Requests are served one at a time when the hardware could process many together. And a single model occupies an entire accelerator while using a fraction of its memory and compute. The next four sections are, in effect, the methods for recovering each of those.
Choosing GPU infrastructure for AI inference
Hardware selection is less mysterious than vendor material suggests. Start from the model, not the catalogue. The weights must fit in accelerator memory with room left for the working state of concurrent requests, so memory is the first constraint and it eliminates most options immediately. Quantisation, which stores weights at lower numerical precision, can halve the memory needed with a small and measurable quality cost, and it is frequently the difference between needing one card and needing two.
After memory, the question is price per unit of throughput for your actual workload, which only a benchmark answers. The newest and largest accelerator is rarely the most economical for a mid sized model, in the same way the largest lorry is rarely the cheapest way to deliver a parcel. We routinely find that a previous generation card, or a smaller current one, delivers more tokens per unit of spend for the models that businesses actually deploy.
- Benchmark with your own prompts and output lengths. Published figures use workloads that flatter the hardware.
- Measure at realistic concurrency. Single request speed tells you almost nothing about a batched server.
- Price three purchasing models: on demand, committed for one to three years, and interruptible spot capacity for workloads that can tolerate eviction.
- Check availability in the regions you need before you design around a specific card. Capacity constraints are real and vary by location.
- Record tokens per second per unit of spend as the comparison figure, not tokens per second alone.
The serving software matters as much as the silicon. A modern inference server implements continuous batching, memory efficient attention, and caching of repeated prompt prefixes, and the gap between a naive loop around a model library and a tuned server is commonly several times in throughput on identical hardware. If a team tells us their self hosted model is slow and expensive, the serving layer is the first place we look.
Kubernetes for AI inference: what it gives you and what it does not
Most organisations that host models end up doing so on Kubernetes, and for good reasons. It is where the rest of the platform already lives, it has a mature ecosystem for GPU scheduling, and it lets inference share the deployment, security, and observability machinery that everything else uses. A team with solid Kubernetes and platform engineering practice can absorb model serving as another workload class rather than a separate estate.
What Kubernetes provides is orchestration: placing model servers on nodes that have the right accelerators, restarting them when they fail, rolling out new versions, and scaling node pools. What it does not provide, out of the box, is any understanding of inference. Its default autoscaling watches processor and memory, which are meaningless signals for a GPU workload. Its default scheduling treats an accelerator as an indivisible unit. Its default readiness assumptions do not anticipate a container that needs four minutes and forty gigabytes before it can serve.
Sharing an accelerator
Giving every model a whole GPU is the simplest configuration and the most wasteful. Several mechanisms allow sharing. Time slicing lets multiple workloads take turns, with no isolation between them. Hardware partitioning splits a card into fixed slices with dedicated memory, which suits several small models with predictable needs. Newer dynamic resource allocation features in Kubernetes let a workload request a fraction or a specific configuration of a device. For embedding models, rerankers, and classifiers, which are small and bursty, sharing routinely turns four cards into one.
Node pools and placement
Keep accelerator nodes in dedicated pools, tainted so that ordinary workloads cannot land on them and consume expensive capacity by accident. Use separate pools per card type so the scheduler can make sensible choices. Keep the model weights close: a registry or object store in the same region, and where start time matters, a cache on the node itself so that a new replica does not download the same forty gigabytes its neighbour already holds.
Autoscaling and the cold start problem
Autoscaling is where inference infrastructure most often disappoints, because the feedback loop is slow. From the moment demand rises to the moment a new replica serves its first token, several things must happen in sequence: a node must be provisioned, the accelerator driver initialised, a large container image pulled, the weights fetched and loaded into memory, and the server warmed. End to end this takes between two and ten minutes in the setups we see. A traffic spike is usually over before the capacity arrives.
You cannot make that loop instant, so the design goal is to make it matter less. The techniques stack.
- 01Scale on the right signal. Queue depth, requests in flight, or time to first token reflect load on a model server. Processor utilisation does not.
- 02Shorten the start. Bake weights into the node image or a local cache, keep images lean, and use a fast loading format. Minutes can become tens of seconds.
- 03Hold a small warm buffer. One spare replica above current need absorbs most spikes while the slow loop catches up.
- 04Scale by schedule as well as by signal. Most business traffic has a daily shape. Adding capacity at eight in the morning is cheaper than reacting at nine.
- 05Control admission. When the queue exceeds what can be served within the latency target, reject or degrade early rather than letting every request become slow.
- 06Overflow elsewhere. Route excess traffic to a hosted API at peak so that the fleet can be sized for the typical hour, not the worst one.
Scale to zero deserves a specific mention because it is attractive on paper. For an internal tool used twice an hour, letting the model unload and accepting a slow first response is entirely reasonable and saves most of the cost. For a customer facing feature, a multi minute wait is not a degraded experience, it is an outage. Decide per workload, and say the trade out loud to whoever owns the product.
Batching, caching, and routing: free throughput
Once capacity roughly follows demand, the remaining gains come from doing more work per GPU second. These techniques cost engineering time rather than money, and they compound.
Continuous batching
An accelerator processes many sequences in parallel almost as quickly as one. Continuous batching exploits this by adding incoming requests to the batch already being generated, token by token, rather than waiting for a group to assemble. The effect on throughput is large, commonly several times, at a modest cost in per request latency. It is the single most valuable feature of a modern serving stack, and it is why concurrency, not raw speed, is the figure to benchmark.
Caching what repeats
Real workloads are repetitive. System instructions are identical on every call. Retrieved documents recur. Some user questions are asked hundreds of times a day. Prefix caching lets the server reuse the computation for a shared prompt opening, which cuts both latency and cost on every request that starts the same way. A response cache in front of the model, keyed on the normalised request, answers exact repeats without touching a GPU at all. Neither is exotic and both are routinely left switched off.
Routing by difficulty
Not every request needs the largest model. A lightweight classifier or a simple set of rules can send short, simple tasks to a small model on cheap hardware and reserve the large one for requests that need it. In workloads we have profiled, the simple majority is often well over half of traffic. A gateway in front of the fleet is also where rate limits, per customer quotas, fallbacks, and the overflow path to an external API belong.
Observability for a workload that fails quietly
An inference service has two kinds of failure. The loud kind is familiar: a replica crashes, a node runs out of memory, the queue overflows. The quiet kind is specific to this workload: latency creeps upward as prompts grow, a new model version is subtly worse, a cache stops hitting after an innocent change to a template. Standard infrastructure monitoring catches the first kind and misses the second entirely.
The signals worth collecting fall into three layers. At the hardware layer: utilisation, memory in use, temperature, and errors per accelerator. At the serving layer: time to first token, tokens per second, queue time, batch size, cache hit rate, and request and output lengths, all as distributions rather than averages, because the ninety fifth percentile is what users complain about. At the product layer: cost per request and per customer, and a quality score from a small set of evaluation prompts run on a schedule.
Treat these the way a mature team treats any production system. Define a latency objective users would recognise, alert on burn against it rather than on raw thresholds, and rehearse what happens when a region runs out of capacity. This is ordinary site reliability engineering with unusual metrics, and teams that already practise it adapt quickly. Teams that do not tend to discover their monitoring gap during the first incident.
The AI inference cost model, line by line
A defensible cost model for self hosted inference has more lines than the GPU. When a business case omits these, the surprise arrives in month two.
- Accelerator hours, at the blended rate across on demand, committed, and spot capacity.
- Idle capacity: the warm buffer, the overnight floor, and the headroom held for failover. This is usually the largest hidden line.
- The rest of the node. Processors, memory, and fast local disk attached to each GPU are not free.
- Storage and transfer for weights, images, logs, and traces, including the cost of moving large artefacts between regions.
- Non production environments. A staging fleet and a benchmarking environment are needed and are rarely budgeted.
- Engineering time to build and to run. At least part of one or two experienced engineers, permanently, plus an on call rota.
- The fallback API spend for overflow and for the requests the small model cannot handle.
Put the engineering line in honestly. For a small deployment it frequently exceeds the hardware. That is not an argument against hosting. It is the reason the decision should be made on total cost at realistic utilisation, compared against an API bill at the same volume, with a break even point you can state. In the cases we have modelled, that point tends to appear only at sustained, substantial volume, and it moves later every time API prices fall.
Timeline: how long a production deployment takes
For a business with an existing Kubernetes platform and a model already chosen, a realistic path looks like this. Two weeks to benchmark hardware and serving configurations against real prompts and to write the cost model. Three to four weeks to build the serving layer, node pools, image pipeline, and gateway. Two to three weeks for autoscaling, observability, load testing, and failure drills. Then a period of shadow traffic and gradual cutover, typically two to four weeks, during which the API remains the safety net.
That is eight to twelve weeks to a fleet you can trust, and tuning continues for months afterwards as real traffic reveals its shape. A team without a platform to build on should add time for that foundation or choose a managed endpoint first. Anyone offering a production grade deployment in a fortnight is describing a demo.
How to choose an AI inference infrastructure partner
If you bring in outside help, the quality of the questions they ask in the first meeting tells you most of what you need to know.
- They ask about volume, traffic shape, and latency targets before they mention hardware.
- They are willing to conclude that you should stay on an API, and can show the arithmetic.
- They talk about utilisation, batching, and cold starts unprompted. A partner who only discusses instance types has not run this in production.
- They insist on benchmarking with your prompts and present cost per request, not tokens per second.
- They build on your platform, in your accounts, as code you own, with runbooks your team can follow.
- They include observability, load tests, and a fallback path in the first scope rather than a later phase.
Be cautious of proposals that begin with a hardware reservation or a multi year commitment. Commitments are the last step, taken once measured utilisation justifies them, not the first.
A decision path you can follow
- 01Measure demand. Requests per hour across a full week, prompt and output lengths, and the latency users will accept. Without this, every later number is a guess.
- 02Find the smallest model that passes your evaluation. This decides memory, hardware, and most of the cost.
- 03Price the API at that volume, including caching discounts. This is the figure to beat.
- 04Price managed and dedicated options. They often win for a first year.
- 05If self hosting still looks viable, benchmark two or three hardware and serving combinations with real traffic shapes.
- 06Model total cost at fifty percent utilisation, not at one hundred, and include people.
- 07Build with a fallback from day one, cut over gradually, and commit to capacity only after a quarter of real data.
Most teams that follow this honestly stop at step three or four, and that is a success. The ones that continue do so with a number they can defend and an architecture designed around the constraint that matters.
Deciding whether to host your own models?
Bring us your traffic numbers, your latency target, and the model you have in mind. We will benchmark the realistic options, build the cost model at honest utilisation, and tell you plainly whether an API, a managed endpoint, or your own GPU fleet is the right call. If you should stay where you are, we will say so.
Talk to our cloud teamWhat good looks like
A well run inference platform is unremarkable to operate. Capacity follows a daily curve nobody has to think about. Utilisation during working hours sits above half. Requests are batched, repeated prefixes are cached, simple work goes to small models, and overflow goes somewhere safe. A new model version rolls out behind a percentage and rolls back with one command. The dashboard shows latency as users feel it and cost as finance pays it, and both have owners.
The team that built it can also tell you, with a figure, why they host what they host and why they still call an API for the rest. That is the real marker of maturity. The infrastructure is not there because hosting felt serious or because a spreadsheet compared two unit prices. It is there because measured demand, a model that fits, and a utilisation rate they can sustain made it the cheaper and more reliable way to deliver the feature.
Infrastructure is only half of a production AI system, and it is the half that should follow from the product rather than lead it. If you are still shaping what the feature does, which model it needs, and how its output is checked, that work comes first, and it is where our generative AI development team usually starts before a single accelerator is reserved.
We build AI systems and custom software for businesses that want results, not decks. Questions about this article? Get in touch.

