Skip to content
7 min read

How to Analyse LLM Request Costs Properly

Learn how to analyse LLM request costs by model, route, feature and team, then set controls that reduce spend without weakening production quality safely.

Article
How to Analyse LLM Request Costs Properly

A single support copilot can look inexpensive in a test environment, then become a material operating cost once thousands of users begin sending long conversations, retrying failed requests and triggering tool-heavy workflows. To analyse LLM request costs properly, treat each request as an operational unit with a purpose, a policy context and a measurable outcome - not simply as a token total on a provider invoice.

The objective is not to select the cheapest model for every task. It is to understand which requests need high capability, which can tolerate lower-cost capacity, where usage is avoidable, and who owns the resulting spend. That gives engineering, FinOps and security teams one shared view of cost without forcing product teams to dilute their user experience.

Start with the cost of one completed outcome

A provider price card is only one input. The cost of a request usually starts with input and output tokens, but production usage adds several variables: model choice, context length, retries, streaming behaviour, fallback traffic and the number of calls required to complete a user action.

A useful baseline is:

request cost = input token cost + output token cost + retry and fallback cost

That calculation is deliberately simple. It creates a consistent unit for comparing requests before adding application-specific factors. For example, an internal knowledge assistant may make one retrieval and generation call per question. A document-processing workflow may call a model repeatedly to classify, extract, validate and correct a result. Their cost profiles should not be compared as if they were the same product interaction.

Measure completed outcomes alongside request cost. For a support assistant, that may be cost per resolved case. For a document workflow, it may be cost per correctly processed document. For a coding copilot, it could be cost per accepted suggestion or completed task. A low-cost request that creates more corrections, escalations or repeat prompts is not automatically efficient.

Separate input growth from output growth

Input tokens often rise quietly. Conversation history, retrieved documents, system instructions, tool schemas and repeated policy text can make an otherwise straightforward prompt expensive before the model generates a word. Output cost tends to rise when prompts leave the requested format unconstrained, allow excessive reasoning or produce broad prose where structured fields would do.

Track input and output tokens separately by model and workflow. If input costs dominate, inspect context construction, retrieval volume and duplicated instructions. If output costs dominate, inspect response limits, task design and whether the selected model is producing more than the downstream system needs. The remedy depends on the shape of the usage, not merely the monthly total.

Attribute every request to a useful dimension

An unallocated provider bill creates debate, not control. Cost analysis becomes actionable when each request can be grouped by the dimensions the business uses to make decisions: application, environment, team, feature, customer segment, model, provider and logical route.

Do not make attribution so detailed that teams cannot maintain it. Begin with the dimensions that answer real decisions. A platform team may need spend by application and route. A product leader may need spend by feature and tenant tier. Security may need to identify whether requests containing sensitive data followed the intended controls. The same request trace should support each investigation without exposing payloads unnecessarily.

Metadata-only logging is usually the right default for cost work. Request identifiers, timestamps, model selections, token counts, latency, policy outcomes and cost estimates are enough to explain most spend movements. Retain payloads only where there is a documented need and explicit opt-in, because verbose prompts can themselves contain personal or commercially sensitive information.

Build a daily cost view, then investigate variance

Monthly reports are too late for fast-moving usage. A daily view should show request volume, input tokens, output tokens, estimated cost, error rate and latency by application and route. Compare each measure with a trailing baseline rather than reacting to one high-usage day in isolation.

When cost rises, follow a fixed diagnostic sequence. First ask whether request volume increased. Then determine whether the token profile changed. Next check whether traffic moved to a different provider or model, whether retries or failovers rose, and whether a product release changed prompt construction or workflow depth. This avoids the common mistake of blaming a model price change for what is actually a retrieval regression or runaway retry loop.

Analyse LLM request costs by route, not provider alone

Provider-level reporting is necessary for procurement, but it is not sufficient for engineering decisions. One provider can serve several workloads with radically different quality, latency and data-handling requirements. A model that is appropriate for complex legal-document review may be excessive for short intent classification.

Named routes provide a better operating unit. Define routes around a capability requirement, such as low-latency classification, balanced customer assistance or high-capability analysis. Then evaluate each route against its expected quality, latency and cost envelope. The aim is to prevent individual applications from making isolated model choices that slowly fragment the estate.

Routing rules and priorities should be reviewed with evidence. If a lower-cost model meets the agreed quality bar on a route, it may be the appropriate first choice. If it fails a known class of request, escalation to a more capable option can be justified. Conversely, routing every request to the strongest available model because some requests are difficult guarantees unnecessary spend.

This is where price and quality must be analysed together. Sample real production tasks, define acceptance criteria, and compare outcomes across candidate models. Automated checks can help for structured extraction and classification, while human review remains valuable for nuanced writing, judgement and safety-sensitive outputs. The right decision depends on the failure cost of the workload.

Account for governance controls in the request path

Cost control is weaker when it is separated from security and operational policy. A request that should have been blocked for sensitive data exposure should not reach a model simply because the finance view begins after provider usage. Likewise, an unsafe output that causes a customer complaint carries a cost that will not appear in token reporting.

A governed request path should apply controls in a predictable order: prompt shield, DLP, routing, then output moderation. This makes policy outcomes part of the same trace used for cost analysis. DLP actions can log, warn, redact sensitive values as [REDACTED], or block the request. That distinction matters: redaction may allow a valid workflow to continue, while blocking is appropriate where the data policy requires it.

Hard spend caps are a separate protection. They do not make a request cheaper or reroute it to another model. They alert or block further usage with a 429 response once the cap is reached. Use them to limit financial exposure, then investigate why the workload reached its ceiling. A cap is a circuit breaker, not a routing strategy.

Turn analysis into operating controls

The most useful cost report ends with a decision owner and a change that can be tested. Set budgets at the level where action can occur, such as an application, team or environment. Give teams visibility into their route-level usage, but keep central guardrails for organisation-wide commitments and high-risk workloads.

Use scoped API keys to keep ownership and access boundaries clear. Review the cost of development and staging separately from production: experiments are expected to be variable, while production changes should have an accountable release or traffic explanation. For expensive routes, establish a review threshold for prompt changes, model changes and significant context-window growth.

Before applying a routing change broadly, run a representative sample through the proposed configuration. A dry run can help teams inspect the expected route decision without changing live provider selection. Then monitor quality, latency, failure rate and cost after release. Savings that create customer friction are not savings; equally, a modest quality improvement may not justify a large recurring model premium.

routeur.ai provides one governed doorway between applications and model providers, so request-level traces, routing decisions, policy outcomes and spend controls can be assessed in the same operating layer. Applications can use an OpenAI-compatible endpoint while their business logic stays byte-for-byte identical, reducing the effort required to introduce consistent measurement and control.

The practical standard is straightforward: every meaningful increase in LLM spend should be explainable by volume, token shape, route choice, retries or a deliberate product decision. When a team can answer that question from per-request evidence, cost optimisation stops being an invoice exercise and becomes normal production engineering.

Put every prompt through one governed doorway.

Route a slice of your traffic through routeur.ai and see the controls — routing, DLP, shields and a full audit trail — on every request.

Start your free trial →