Skip to content
Guide · Build

Where the money goes in an LLM application

Token prices get the attention, but they are rarely the largest line. This guide breaks the cost of an LLM application into four buckets, shows what drives each and lists the levers that make the biggest difference.

Updated 6 Nov 2026 · 9 min read · By Teksmobile AI practice

The four cost buckets

Every LLM application we have costed falls into the same four buckets. The proportions vary enormously by use case, which is why rules of thumb mislead.

  1. Model tokens. What the provider charges for input and output, or what self-hosted inference costs in hardware and power.
  2. Retrieval and infrastructure. Vector storage, embedding, search, the application servers, gateways and logging around the model.
  3. Evaluation and monitoring. Building and maintaining test sets, running them, sampling production, dashboards, red teaming.
  4. People and maintenance. Engineers, product and domain experts to build, tune, operate and change the system over its life.
Illustrative share of first-year cost for three application types. Internal copilot: tokens 25 percent, retrieval and infrastructure 15, evaluation and monitoring 20, people 40. Customer-facing assistant: tokens 45, retrieval 20, evaluation 15, people 20. Document pipeline: tokens 35, retrieval 25, evaluation 15, people 25 ILLUSTRATIVE SHARE OF FIRST-YEAR COST, indicative proportions, not measured data Internal copilot 25% 15% 20% 40% Customer-facing assistant 45% 20% 15% 20% Document pipeline 35% 25% 15% 25% Model tokens Retrieval & infrastructure Evaluation & monitoring People
The same four buckets produce three very different shapes. The customer-facing assistant is the only one where tokens dominate; for the others, people and evaluation do.

What drives the token bill

Providers charge per token, with input and output priced differently and output usually costing more. Four things decide the total.

Traffic. Requests per day, multiplied by tokens per request. This is obvious, and it is the number most often underestimated, because successful features get used.

Context length. Every request carries your instructions, any retrieved documents, the conversation history and the user's message. A system prompt of two thousand tokens, sent on every one of fifty thousand daily requests, is a hundred million input tokens a day before anyone has asked anything. Treat the context window as a budget rather than a target.

Model tier. Frontier models cost multiples of smaller ones from the same provider. Many tasks in a real application, such as classification, extraction and routing, do not need the frontier model at all.

Caching. Most providers now offer prompt caching, which charges much less for the repeated prefix of a prompt. Long, stable system prompts and shared document context are exactly the shape caching rewards. Design prompts so the stable part comes first.

Retrieval and infrastructure

For a RAG system, this bucket includes embedding the corpus (a one-off cost, repeated when the embedding model changes), storing and searching vectors, re-embedding on updates, and the reranker if you use one. For most knowledge bases these costs are modest compared with tokens and people; they grow with corpus size and query volume, and they spike when you change embedding models and have to re-index everything. Our RAG cost estimator sizes this for your document counts.

Around the model sits ordinary infrastructure: application servers, a gateway for routing and logging, queues for batch work, storage for traces. None of it is exotic. All of it is forgotten in the first estimate.

Nobody budgets for evaluation and monitoring

You cannot run an LLM system responsibly without knowing whether it is doing the job, and that knowledge costs money. Building the first evaluation set takes domain experts' time. Running it on every prompt, model or retrieval change costs tokens. Sampling production outputs for review costs reviewer hours. Dashboards, alerts and drift detection cost engineering time. Red teaming before launch and after major changes costs specialist time.

Teams that skip this bucket do not save the money; they pay it later in incidents, in arguments about whether the system has got worse, and in the inability to upgrade models safely. Budget it explicitly, as described in evaluating LLM outputs and our LLMOps and monitoring service.

People and maintenance

For an internal tool with modest traffic, people are the majority of the cost over the first year: the engineers who build it, the domain experts who write evaluation cases and review outputs, the person who owns it afterwards. The model bill is a rounding error by comparison. The lesson is to choose projects where the people cost buys something worth having, and to keep scope tight, as our AI project roadmap recommends.

Maintenance is real and ongoing. Providers retire models, documents change, users find new failure modes. Plan for a fraction of the build effort every year, indefinitely.

The levers that cut cost

LeverWhat it doesTypical effectCost of pulling it
Model routingSend simple requests to a cheaper model, hard ones to the frontier modelLarge, where traffic is mixedA classifier and an evaluation set per route
Prompt cachingReuse the stable prefix of prompts at reduced priceLarge, for long system prompts and shared contextReordering prompts so stable content comes first
Prompt trimmingShorter instructions, fewer retrieved chunks, summarised historyModerate to largeEvaluation to confirm quality holds
Smaller modelsUse a small or open-weight model for focused tasksLarge per token; total depends on qualityEvaluation; possibly hosting
Batch processingRun non-urgent work through batch endpoints or off-peakModerate, for pipelinesLatency tolerance
Caching responsesReturn stored answers for repeated or near-identical questionsModerate, for FAQ-shaped trafficInvalidation logic
Output limitsCap response length; ask for structured outputSmall to moderateMinimal

Routing and caching are the two that matter most. Together they often change the shape of the token bucket entirely. Where a system runs, covered in on-prem vs cloud LLMs, affects the inference cost shape too, but rarely as much as these two levers.

An illustrative example

Illustrative scenario, relative figures only. A support assistant answers customer questions from documentation. In its first version every request sends a long system prompt, ten retrieved chunks and the full conversation history to a frontier model. Call its monthly token cost 100 units.

The team reorders the prompt so the system prompt and shared context come first and switches on caching: the repeated prefix is now charged at a fraction of the rate, and the bill drops to roughly 70. They cut retrieved chunks from ten to five after the evaluation set shows no quality loss, and summarise history beyond the last few turns: roughly 50. They add a router that sends simple "where do I find" questions to a smaller model, which the evaluation set shows handles them as well: roughly 35. Three changes cut the bill to about a third with no loss of measured quality. The evaluation set that made each step safe cost less than one month's saving.

Cost-control checklist

  • Estimate tokens per request and requests per day before building, with a growth range.
  • Put a gateway in front of every model call to log usage and attribute cost per feature and tenant.
  • Set spend alerts and per-user or per-tenant budgets from day one.
  • Order prompts for caching; keep the system prompt stable.
  • Build the evaluation set early so every cost lever can be pulled safely.
  • Route by task; do not send everything to the frontier model.
  • Budget evaluation, monitoring and maintenance explicitly for the life of the system.

Pitfalls

How LLM budgets go wrong

Costing the pilot rather than the product. Pilot traffic is a tenth of production traffic, and prompts only get longer.

Trimming tokens on an internal tool. Weeks of engineering to save a bill smaller than the engineers' time.

No per-feature attribution. One bill, five features, no idea which one is expensive.

Cutting evaluation to save money. This is the one bucket whose absence makes every other bucket riskier.

Switching to a cheaper model without a test set. The savings are real; so is the quality drop nobody measured.

If the question behind this guide is "was it worth it", read measuring AI ROI next; cost is only half of that calculation.

What matters most

  • There are four buckets: tokens, retrieval and infrastructure, evaluation and monitoring, and people.
  • Tokens dominate only for high-traffic customer-facing systems; elsewhere people and evaluation do.
  • Context length and traffic drive the token bill; the context window is a budget.
  • Routing and prompt caching are the two levers that change the shape of the bill.
  • Evaluation is the bucket nobody budgets and the one that makes every saving safe.
  • Log and attribute cost per feature from day one.
FAQ

Frequently asked questions

Is the model API bill the biggest cost?

Only for high-traffic customer-facing systems. For most internal tools and pilots, people and evaluation dominate, and the token bill is a minor line. The mistake is trimming the small line while ignoring the large one. Use the LLM cost calculator to see which case you are in.

How do we estimate token cost before we build?

Count requests per day, estimate average input tokens (instructions plus retrieved context plus the user's message) and output tokens, then multiply by the provider's published rates for the model tier you expect to use. Build in a range, because context length and traffic always grow. Prompt caching and routing can cut the estimate materially.

Does a smaller or open-weight model always cost less?

Per token, usually. In total, not always: a smaller model may need more retries, more careful prompting and more evaluation effort, and self-hosting adds infrastructure and people. Compare total cost for the task at the quality you need. See small language models.

What is the cost everyone forgets?

Evaluation and monitoring. Nobody budgets for building and maintaining the test set, running it on every change, sampling production outputs and watching for drift. It is the difference between a system that improves and one that quietly degrades.

Talk to us about your AI project

Tell us what you are trying to do, which systems are involved and what is in the way. We reply within one business day with an opinion and a suggested next step.