Portfolio Services Company Contacts Blog Get a Quote
uaruen
Marble Hermes guides data flows and model blocks with both helmet wings fully visible.
Artificial Intelligence

How to Reduce AI Token Costs Without Losing Quality

Ivan Deineka
Ivan Deineka
CEO at BotLabs
· Updated 9 min read
Key takeaway: Optimize from usage data: measure cost per successful task and test caching, batch processing, and model routing.

Optimize from measured spending, not from a generic tip list. First remove unnecessary context. Then test whether a stable prompt prefix can be reused, move non-urgent work to batch processing, and route simple requests to a lower-cost model while reserving a stronger one for harder cases. Each method can lower the bill, but under the wrong conditions it can add cost or harm results.

The key metric is the cost of a successfully completed task, not the price of one model call. A cheap call that leads to escalation, a retry, or manual correction may cost more than one expensive call. This guide lays out how to inspect your bill, trim context, test caching and batch jobs, and evaluate model routing.

First, break down the bill

A monthly total does not reveal what drives it. Log each call with:

  • input tokens split into regular, cached-read, and cache-write tokens;
  • output tokens;
  • model and service tier;
  • task type, such as classification, customer reply, or document summary;
  • calls per task, including retries;
  • outcome: completed, escalated, or failed.

Some APIs report cached tokens separately from total input, and newer models may also report tokens written to the cache. Keep those fields instead of storing only the total.

After a week or two, the largest cost may turn out to be one task with a long context, retries caused by an unstable output format, or overly detailed answers. Start with the biggest line item.

Measure each change by cost per accepted task: all call costs during the period divided by the number of tasks completed at the required quality. If a call becomes cheaper but an accepted task becomes more expensive, the change did not help.

Remove unnecessary context

Do not send the model information it does not need. Common sources of excess tokens include:

  • Duplicates: the same knowledge-base passage appears in the prompt from different search results.
  • The entire chat history: of twenty messages, only the latest two and the gist of the first matter.
  • Whole documents instead of relevant passages: for example, a forty-page contract when the question concerns one clause.
  • Outdated instructions: rules added “just in case” that no longer affect the result.
  • Overlong answers: five paragraphs where two sentences would do increase output-token charges.

Remove duplicates before sending, retrieve only relevant passages, replace long histories with a verified summary, and specify the answer format and maximum length.

Here is an illustrative calculation. Replace a 3,000-token conversation history with a verified 800-token summary, and each call uses 2,200 fewer input tokens. At $2 per million input tokens, that saves $0.0044 per call, or $440 across 100,000 monthly calls. At $0.10 per million, the same change saves only $22; engineering time may be better spent elsewhere. Prioritize based on your own bill, not a general list of optimizations.

There is a risk: a shorter prompt can remove something important, such as an order number or an exception to a return policy. Test each reduction on the same fixed evaluation set used before the change. Quality should not fall.

Configure prompt caching

Prompt caching does not store completed answers. It reuses processing for a matching beginning, or prefix, of a request. If many requests start with the same instructions and reference material, a supported model may process that part again at a lower rate.

For some newer models, conditions checked on 11 October 2026 work as follows: caching is on by default; the entire rendered prefix must match, and the system looks for the longest match. For models from GPT-5.6 onward, the minimum cacheable prompt length is 1,024 visible input tokens. A prefix remains eligible for reuse for 30 minutes after its last write or use. Cached reads cost 0.1 times the regular input rate for these models, and 0.05 for GPT-6.1 Sol. Cache writes cost 1.25 times the regular rate. Older models may follow different rules, so check the exact model.

Practical guidelines:

  • put stable instructions and reference material first;
  • put changing content—user question, date, name, retrieved passages—at the end;
  • measure actual cache hits instead of assuming a hit rate.

Example: separate cache reads and writes

Illustration using Standard, short-context rates checked on 11 October 2026 for gpt-6.1-sol: $2 per million regular input tokens, $0.10 for cached reads, $2.50 for cache writes, and $10 per million output tokens. A request has 6,000 input tokens, including a 4,000-token stable prefix, and 800 output tokens.

ScenarioCalculationCost per call
No cache(6,000 × $2 + 800 × $10) ÷ 1,000,000$0.020
Prefix read from cache(4,000 × $0.10 + 2,000 × $2 + 800 × $10) ÷ 1,000,000$0.0124
Prefix written to cache(4,000 × $2.50 + 2,000 × $2 + 800 × $10) ÷ 1,000,000$0.022

Assume every cache miss creates a new write. At a 90% hit rate, average cost is 0.9 × $0.0124 + 0.1 × $0.022 = $0.01336, about one-third below the uncached cost. At 50% hits, the cost is $0.0172, only 14% lower. If requests arrive less than once every 30 minutes and each requires a new write, a call costs $0.022—10% more than without caching.

Track cached reads separately from total input and, when writes are billed, track cache-write tokens too. A stable prompt does not prove that the full request is cached.

Choose work for batch processing

Batch processing is asynchronous: submit a file of requests and receive results later. The conditions checked on 11 October 2026 for one batch API included a 50% discount against synchronous processing, a completion window of up to 24 hours, up to 50,000 requests, and a 200 MB input file. It has separate limits. These terms are provider-specific and can change, so verify the service you use.

The discount applies only to requests sent through the batch method. Good candidates include overnight classification of the day’s support tickets, extracting fields from archived contracts, generating catalog descriptions, and scheduled evaluation on a fixed test set.

Poor candidates are tasks where a customer or employee needs an immediate response: a website chat, an agent suggestion during a call, or a pre-submission check. A result within a day is too slow there.

Mark each task type in your usage log as “must be real time” or “can wait.” The second group is where batch processing may fit.

Add model routing

Routing selects a model based on task complexity: a lower-cost model handles simple requests, a stronger model handles harder ones, and unresolved cases go to a person. It may lower model charges when task categories can be separated reliably. The result depends on the models, evaluation sample, and quality thresholds; no fixed savings percentage is guaranteed.

An illustrative support flow:

  1. A lower-cost model classifies a short request in a known category and drafts a response.
  2. Rules check that the category is approved for automation, required fields are present, and the request shows no sign of a complaint or legal issue.
  3. If a rule fails, send the request to a stronger model.
  4. If there is still not enough information, send it to a person.

Use external escalation signals, such as a missing field or an uncovered category. A model’s own confidence score is a weak signal. Set a retry limit so a request cannot loop between models.

Example: routing costs

Using the same request size (6,000 input and 800 output tokens), one gpt-6.1-sol call costs $0.02 and one gpt-6-luna call costs $0.001. For 1,000 requests:

  • all requests through the stronger model: 1,000 × $0.02 = $20;
  • start with the lower-cost model and escalate 20%: $1 + 200 × $0.02 = $5;
  • escalate 60%: $1 + 600 × $0.02 = $13.

An escalated request incurs both calls. Routing stops being cheaper on model charges when $1 + escalation share × $20 = $20, or a 95% escalation rate.

But model charges are not the whole picture. Suppose, purely for illustration, 1% of lower-cost model answers are wrong and pass rule checks unnoticed, and each costs the business $2 in staff time to correct. With 20% escalation, the lower-cost model answers 800 requests; eight hidden errors cost $16. The total is $5 + $16 = $21, more than using the stronger model for every request. The example is fictional, but it shows how the cost of an unnoticed error can outweigh token savings.

Protect quality while reducing cost

Treat each optimization as a system change. Keep a fixed set of tasks with reference answers and run it before and after every change. If the test set changes along with the system, the comparison is no longer meaningful.

Track five measures together: refusal rate; error rate against references or rules; latency, especially when routing adds calls; cost per accepted task; and the share escalated to a person.

Do not add discount percentages together. Cached reads, batch processing, and lower-cost models apply to different parts of the bill and under different conditions. Compare actual costs over like-for-like periods at the same quality level.

Change one thing at a time. If you shorten context, restructure the prompt for caching, and add a router simultaneously, a quality drop will be hard to diagnose.

Takeaway and first steps

Token costs can fall, but first understand the bill and check quality after each change. Caching helps only with a genuinely repeated prefix and sufficient request frequency; batch processing is for work that can wait; routing pays off only after counting every call, escalation, and error cost.

  1. Log regular, cached-read, cache-write, and output tokens, task type, and outcome for each call.
  2. Find the largest cost category and start there.
  3. Preserve a fixed evaluation set with reference answers.
  4. Put stable prompt content first and changing content last; measure actual cached tokens.
  5. Move only non-urgent tasks to batch processing.
  6. For routing, include both calls during escalation and the cost of unnoticed mistakes.
  7. Make one change at a time and compare refusals, errors, latency, and cost per accepted task.

BotLabs specialists can discuss your task types, current costs, and how to measure an optimization pilot. Any conclusion depends on your data and quality criteria.

Frequently asked questions

No. Prompt caching reuses processing for the same beginning of a request, such as shared instructions and reference material. The model still generates a new response. A cache of completed answers is a separate mechanism you build yourself; after a rule changes, it can return stale information.

Usually not for a bot that must respond immediately. Batch processing is asynchronous, may take up to a 24-hour window, and its discount applies only to requests submitted that way. Related tasks can still be batched: overnight conversation analysis, evaluation against a test set, or preparing knowledge-base material.

When total costs exceed the savings from cheaper first calls: paying again on escalation, a separate model call for the router, added latency, hidden errors, or maintaining routing rules. In this article’s fictional example, a 1% rate of missed errors at $2 each erased the token savings.

Request a consultation

15 min · specialist consultation

AI task cost consultation

In 15 minutes with a BotLabs technical specialist, discuss one task type and the costs of calls, retries and manual corrections. Define a successful result and the first change to test in a pilot, including its effect on quality.

15 minutes with a specialist.

A BUSINESS CONSULTATION
COST PER TASK → QUALITY CHECK → NEXT STEP

Cost per task
Quality check

15 minutes with a specialist to discuss total task cost and an initial optimization check on a fixed evaluation set.

specialist consultation15 min · specialist consultation
… click to support
Ivan Deineka
Ivan Deineka
CEO at BotLabs
Ivan Deyneka is an entrepreneur and founder of BotLabs Agency, with over 8 years of experience launching and scaling digital products in the field of business automation.
← Back to Blog

Recommended articles

AI task costs15 minutes with a specialist.Request a consultation