LISTICLE14 min read

7 Rules for AI Token Cost Management in Production

A practical guide to controlling production AI spend without trading away answer quality, reliability or tenant boundaries.

P
PADISO teamPublished 5 Nov 2026

Production AI token cost management is about controlling the work your system sends to a model, not just choosing a cheaper model. Put cost controls in the request path: reuse stable context, avoid unnecessary model calls, route work by difficulty, enforce budgets and measure spend against completed tasks. Start by mapping these decisions across your AI strategy and solutioning, then make them part of the production design.

Token prices are only one part of the bill. A request can include instructions, tool definitions, retrieved documents, conversation history, internal reasoning and retries. Analysing total AI token cost requires evaluating each of these components in detail. A small change to any of these can increase the number of tokens, the number of model calls or both. That is why a cost plan based only on a model’s listed input rate can miss the biggest sources of spend.

The seven rules below are designed for engineering leads who need controls that work in production and finance leaders who need costs they can explain. Apply them together, and keep quality, privacy and reliability in the same conversation as spend.

1. Order prompts to make provider caching useful

Provider prompt caching reuses the processing of a repeated prompt prefix. It is different from semantic caching, which we cover in the next rule. With prompt caching, the provider can reuse a matching beginning of a request rather than treating all of its input as new. Each provider has its own eligibility rules, cache behaviour and price schedule, so check the current OpenAI prompt caching documentation, Anthropic prompt caching guide and Gemini context caching documentation before relying on it.

The practical rule is to put stable content first and changing content later. A common order is:

  1. Stable system instructions and output rules.
  2. Reusable reference material or fixed context.
  3. Tool descriptions and schemas that do not change from call to call.
  4. Conversation history, retrieved passages and current task details.
  5. Volatile values such as timestamps, request IDs and user input.

This order gives an identical prefix a better chance of being reused. If a timestamp or unique session identifier appears near the start, it can make the prefix different for every request. The content may look almost the same to a person, but caching depends on the provider’s matching rules, not a human judgement that two prompts are similar.

Treat cache behaviour as an engineering property to verify, not a saving to assume. Practical evaluations of agent prompt caching cost savings demonstrate that net efficiency depends heavily on prefix hit rates and cache write overheads. Log whether each request was cache eligible and whether the provider reports a cache read or write. Compare the result with the uncached baseline using the same workload. Include cache write costs, cache lifetime and the chance that a prefix will be reused before it expires. A cache that rarely gets a second use may add complexity without reducing spend.

Keep user or tenant-specific information out of shared prefixes unless the provider’s cache design and your privacy controls support that use. Do not make a cache hit the reason sensitive content can cross a tenant boundary. Prompt structure should improve reuse while preserving the same access controls and data handling rules as an uncached request.

2. Put semantic caching in the gateway, with strict checks

Semantic caching tries to avoid a model call altogether. A gateway compares a new request with previous requests and, if it considers them equivalent, returns a stored answer. Unlike provider prompt caching, it can match different wording. That makes it useful for repeated questions with stable answers, but it also introduces a correctness risk: similar wording does not always mean the same intent.

For example, “How do I upgrade my plan?” and “How do I cancel my plan?” share vocabulary but require opposite answers. A broad similarity rule can return a confident, irrelevant response. In a financial, insurance or customer support workflow, that is not merely a cost issue. It is a service and control failure.

Build semantic caching as an explicit decision at the gateway, not as an invisible shortcut inside an application. For each candidate hit, check the conditions that matter to the request:

  • Tenant and user access scope match.
  • The intent or operation matches, not just the topic.
  • The answer is still valid and has not been superseded by a policy, price or account change.
  • The request does not contain a negation, exception or new fact that changes the answer.
  • The stored response was produced from an approved source and model version.
  • The result meets a workload-tested confidence threshold.

Do not copy a similarity threshold from a blog or another team. Set and test it against a labelled sample of your own queries. Include near misses, opposite intents, misspellings, changed dates and requests containing customer-specific details. Decide what a false hit costs in your business. For low-risk FAQs, a cache hit may be acceptable with a clear invalidation process. For advice, eligibility or account actions, bypassing the model may be inappropriate unless deterministic checks establish that the cached result remains correct.

Track hit rate and quality together. A high hit rate is not a success if more users receive stale or wrong answers. Record cache hits, misses, rejected candidates, user corrections and escalation rates. Make invalidation straightforward when a source document or business rule changes. Semantic caching can sit alongside provider prompt caching: one reuses a complete answer at the gateway, while the other can reduce the cost of processing a reused prompt prefix when the model still needs to run.

3. Compress the context before it reaches the model

A production prompt often contains more material than the model needs. Retrieval systems can return long passages with repeated boilerplate, old versions, irrelevant sections and disclaimers. An agent may also carry the entire conversation forward even when only a few facts matter to its next action. The result is more input to process and, in some systems, more context resent on every turn.

Start with simple compression before adding a specialised model. Remove duplicate passages, cap the number of retrieved chunks, strip navigation and formatting noise, and select only the sections that answer the current question. Store structured facts in a compact form where that is safe and useful. Summarise earlier conversation history into an explicit state object, but retain the original source or trace when an audit or later verification requires it.

For complex long-context workloads, test a prompt compression method such as LLMLingua or LongLLMLingua. These approaches aim to preserve useful information while reducing the number of tokens sent to the main model. The research source listed for LongLLMLingua describes the method, but a benchmark result is not a guarantee for your prompts. Compression can remove a qualification, exception or exact number that the model needs. Test the compressed context on representative tasks and compare both cost and answer quality with the uncompressed baseline.

A sound evaluation set should include:

  • Straightforward requests where compression should make little difference.
  • Questions that depend on a small detail buried in a long document.
  • Conflicting or superseded source passages.
  • Exact names, dates, quantities and contractual language.
  • Cases where the right response is to say the evidence is insufficient.

Measure the tokens saved, any extra time or compute spent compressing, the end-to-end latency, and task success. A compression step that costs more than it saves, or weakens answers on important cases, is not an optimisation. Consider a small model for compression only after measuring its own cost and failure modes. If the output goes into a high-stakes workflow, preserve citations or source references so the final answer can be checked.

4. Route requests by task difficulty, not by habit

Sending every request to the same model is easy to implement, but often wastes money or produces avoidable failures. A lightweight classification or formatting task may not need a model intended for deep reasoning. Conversely, choosing the lowest-priced model for a difficult task may lead to retries, tool errors or a poor answer that someone must fix.

Use a tiered route. A small or lower-cost model can handle defined, low-risk tasks such as intent classification, simple extraction or routing, provided it meets your quality bar. A more capable model can handle ambiguous questions, multi-step reasoning or tasks where the cost of an error is higher. A deterministic program may be better than either model for fixed rules, arithmetic or data lookup.

The route should be based on evidence. Build a test set from real tasks and label the minimum acceptable result. Compare models on task completion, structured output validity, tool selection, escalation rate and retry frequency. Then choose a route that meets quality and reliability requirements at an acceptable total cost. The OpenAI API pricing page and Anthropic pricing documentation show why you should also check the current provider rates, rather than rely on old comparisons. Pricing and model availability change, and a published rate alone does not tell you the cost of a successful task.

A useful cascade has an explicit escalation path. The first model can return a confidence or decision signal, but do not trust a self-reported confidence score without testing whether it predicts actual success. Escalate when required fields are missing, the answer conflicts with a rule, a tool call fails or an evaluator detects a material gap. Set a maximum number of attempts so the cascade cannot repeat indefinitely.

Keep the route visible in logs. For each task, record which model handled it, why it was selected, whether it escalated, and what happened next. This makes it possible to find where a more capable model earns its cost and where a small model is already sufficient. A router is a policy that needs maintenance. When the task mix, prompt, model version or business risk changes, rerun the evaluation rather than assuming the old route remains right.

5. Centralise gateway controls and set tenant budgets

A shared AI gateway system design gives you one place to authenticate requests, select providers, apply limits and record usage. It also prevents the organisation from relying on a collection of unmanaged provider keys spread across applications and teams. A gateway is not a substitute for solid enterprise architecture and platforms, but it can enforce policy consistently before a request reaches a model provider.

Create separate identities and budgets for the things finance and engineering need to distinguish: production versus development, business unit, application, environment and customer tenant. Avoid a single company-wide key if it makes it impossible to identify who generated the bill. Do not give a tenant access to another tenant’s budget or usage data through the gateway’s reporting interface.

Set limits in more than one unit. Requests per minute can protect service capacity, but it does not control request size. A single large prompt can use far more tokens than a short one. Consider limits for tokens per minute, maximum input size, maximum output size, concurrent requests and spend over a defined period. Use a pre-flight estimate where possible, then reconcile against actual usage reported after the response. Streaming complicates exact estimation, so reserve a reasonable amount before the call and settle the difference after completion.

Define what happens at each threshold. A warning can notify a team before a budget is exhausted. A soft limit can trigger cheaper routing or ask an operator to approve additional spend. A hard limit can reject further calls. For a customer-facing service, an abrupt rejection may create an availability issue, so choose a deliberate fallback: queue the request, use a permitted lower-cost route, return a useful partial response or direct the user to a human. The right behaviour depends on the task and service commitment.

Test the controls under failure conditions. What happens if usage reporting is delayed, the gateway database is unavailable or a provider returns a rate limit? Ensure the system does not fail open and allow unlimited traffic without alerting. Equally, avoid a single central gateway becoming an untested point of failure. For Australian regulated organisations, map these controls to the organisation’s existing operational resilience and information security obligations, including relevant APRA requirements where they apply in AI for financial services in Sydney. The AI agents and automation service covers production workflows where routing, observability and spend controls need to work together.

6. Bound output and reasoning before a call starts

Input tokens are not the only cost driver. Generated output can be expensive, especially when a model supports internal reasoning or other output modes billed separately under the provider’s current terms. Long answers, repeated explanations and oversized structured results also create extra processing for downstream systems and users.

Set a maximum output length for every production request. Choose the limit based on the actual job, not a generous default copied from a prototype. A classification may need a short label and a reason code. An extraction task may need a fixed schema. A drafting task may need more room, but should still have an upper bound. Ask for the fields your application consumes and do not request a full narrative when a structured answer will do.

Where a provider supports configurable reasoning effort or a reasoning-token budget, use the lowest setting that passes your task evaluation. These controls are provider-specific and can change, so verify supported parameters and billing details in official documentation before deployment. Do not assume that a short visible answer means little was generated internally. Capture usage fields returned by the API where available, and include them in cost reporting.

Output limits are also a safety control. An agent can repeatedly call tools, return verbose output or enter a loop if the application does not define a stopping condition. Put limits around the whole workflow, not only an individual completion:

  • Maximum model calls and tool calls per task.
  • Maximum elapsed time and retry count.
  • Maximum tokens per request and per task.
  • A clear stop condition when the requested outcome is complete.
  • A controlled hand-off when the system cannot finish within its limits.

When a task exceeds its normal budget, log the reason and decide whether to retry, escalate or stop. Never let retries happen invisibly. A request that fails can still incur input and output charges, and an agent that tries the same action repeatedly can turn one user action into an expensive chain of calls. Keep the response concise by design, then evaluate whether the saved output has preserved the information the user needs.

7. Measure cost per resolved task, not just token price

A model’s price per token is an input to a decision, not the decision itself. The useful business measure is the cost of completing a defined task to an acceptable standard. That includes model input and output, tool calls, retrieval, compression, retries, gateway or infrastructure costs where material, and the human work required to correct or complete the result.

A simple starting formula is:

Cost per resolved task = total attributable cost divided by successfully completed tasks

Define “resolved” before you report the number. For a support workflow, it might mean the user received an approved answer without escalation. For document extraction, it might mean the required fields passed validation. For an internal assistant, it may mean the employee completed the intended action and did not need to repeat the request. A response being generated is not proof that the task succeeded.

Use traces to connect usage to outcomes. At minimum, capture a request or task ID, application, tenant, model and model version, route decision, input and output usage, cache status, tool calls, retries, latency, final status and any human correction signal. Keep personal or sensitive content out of broad cost dashboards unless there is a defined need and suitable access control. A usage record can be useful without retaining the full prompt.

A practical comparison table helps teams make trade-offs explicit:

Measure What it tells you What it can hide
Cost per input token Relative input rate for a model Context size, cache eligibility and output cost
Cost per request Spend for one API call Retries and multi-call workflows
Cost per resolved task Spend for a completed outcome Quality may be defined too loosely
Cost per accepted result Spend for work passing a quality check Human review and downstream operating costs
Cost by tenant or team Who is using the service Whether that use delivers value

Review results by task type, route and tenant. Investigate outliers rather than making a blanket cut. If a model is cheap per call but produces more retries, its task cost may be higher. If a cache lowers spend but increases incorrect answers, it is not a real saving. This is where usage data becomes an operating tool, not just an invoice report. Teams building a broader measurement layer can also consider embedded analytics for reporting costs and outcomes inside the products operators already use.

Turn AI token cost management into an operating routine

Token cost controls need an owner and a review cycle. Start with a baseline from a representative period of production usage. Break it down by application, task type, tenant and model. Identify the largest drivers, which may be oversized context, repeated calls, output length or the route itself. Do not begin by changing every model at once, or you will struggle to tell which change affected quality and spend.

A workable sequence is:

  1. Baseline: instrument requests and agree on what counts as a completed task.
  2. Contain: add per-tenant budgets, token limits and a defined failure response.
  3. Reduce waste: remove redundant context, bound outputs and prevent repeated tool loops.
  4. Reuse: test provider prompt caching and then semantic caching where answers are stable.
  5. Route: compare models on a representative evaluation set and implement an escalation path.
  6. Review: report cost per resolved task alongside quality, latency and availability.

Keep a change log for prompts, model versions, routing rules and budget settings. When a cost suddenly changes, you need to know whether the task mix shifted, a cache stopped matching, a model changed or an application began retrying. Establish alerts for unusual spend and usage patterns, but make them actionable. An alert should identify the affected service and owner, not simply report that the monthly total is higher.

For CFOs, the key is to connect usage to a service, product or business unit and to show the assumptions behind forecasts. For engineering leads, the key is to make cost a measured property of system behaviour, alongside latency and correctness. Both groups need the same shared definitions and a clear process for approving exceptions.

Where PADISO fits

We help teams design AI systems with production controls for routing, usage, reliability and governance through our AI strategy and solutioning and AI agents and automation work. A useful first step is to map one live workflow from request to completed task, then identify where usage, retries and outcomes are being measured.

To assess where your organisation is ready to apply these controls, take the PADISO AI readiness test.

WANT TO TALK THROUGH YOUR SITUATION?

Talk it through with us. Thirty minutes, no slides.

P
Written by the PADISO TeamSydney-based technology leaders who build what they advise on. Seven years of fractional CTO, architecture and AI work for enterprise, government and private equity.

Keep reading

All posts →

Let's talk.

Tell us what you are weighing up, whether it is a build, a roadmap or a deal. You will leave the call knowing your next step.

Book a 30-min callhi@padiso.co