HorizonLux · AI cost

Cut your AI bill without cutting quality

Five levers, applied in the order that works. Most bills are decided by the agent loop, not the model on the invoice.

Get a cost review
Guides

LLM Cost Optimization: 5 Levers to Cut Your AI Bill (2026)

LLM cost optimization: the 5 levers that actually cut an AI bill, in the order that works. Most teams start with caching and save less than they hoped.

A cost pipe narrowing through five LLM optimization levers, from a cost index of 100 down to 21

TL;DR

LLM cost optimization, also called AI cost optimization or GenAI cost optimization, is the practice of cutting what you spend on model inference without cutting output quality. Five levers do the work, and they apply in this order: measure cost per completed task, fix the application layer that is generating the calls, route each request to the smallest model that can finish it, make each individual request cheaper through caching and token discipline, and finally decide where inference runs at all.

Order matters more than technique. Most teams start at lever four because caching is the easiest thing to turn on, then discover the real problem was an agent loop that ran twelve times when it needed three. You cannot optimise a request you should never have sent.

It matters because an LLM bill is not a subscription. It behaves like variable cost of goods sold, except the price is set by someone else and it scales with your success, so growth and burn now rise on the same curve. In April 2026 a four-person startup paid $113,421.87 for a single month of inference.

Underneath all five levers sits the thing that actually makes you defensible: owning the proprietary context that lets a small, specialised model beat a general-purpose frontier one on your task.

Building AI systems that have to survive their own invoice? We design AI agents around cost per completed task, not model benchmarks. It is the number we instrument first on every build.

Key Takeaways

  • LLM costs scale with usage, so revenue growth and inference spend compound together.
  • One documented startup went from $27,690 to $113,421 in three months, roughly 4x.
  • The application layer usually costs more than the model choice. An agent run can cost 19x to 50x a single call because every step re-sends the whole context.
  • Small models under 10B parameters run 10x to 30x cheaper than frontier siblings on narrow tasks.
  • Prompt caching bills repeated tokens at about 10% of standard input price, breaking even after roughly two reads.
  • A cheap model that fails and retries three times costs more than one strong call, so route on cost per completed task, not cost per token.
  • Cost control keeps you alive; a context moat is what keeps you fundable.

Three consecutive 2026 AI invoices for a four-person startup: $27,690 in February, $51,217 in March, $113,421 in April, a 4.1x rise in three months

In April 2026, a four-person startup got an invoice for $113,421.87. Not for salaries. Not for office space. For LLM inference. The company, Swan AI, builds sales agents, and its founder posted the receipt as a badge of honour, proof his tiny team was punching above its weight. Read the receipts in order and a different story shows up. February: $27,690. March: $51,217. April: $113,421. That is not a spend curve. That is a fuse.

You know this number, or a smaller cousin of it. The API line item that used to round to zero now has its own dashboard. Welcome to the discipline nobody put on the roadmap: watching your model spend the way you once watched your runway.

Why an AI bill behaves nothing like a SaaS bill

For two years the story was that AI would replace headcount. The math has partly inverted. Costs to run generative systems are rising faster than the revenue they produce, and the people paying the bills have noticed. Erik Sherman's May 2026 report in Forbes lays out the scale: global tech capex hit roughly $740 billion this year, up about 69% over 2025. That money has to earn a return, and increasingly it is being pushed downstream into the price of a token.

The signals are no longer subtle. In the same reporting, Uber's CTO is described as having exhausted his entire 2026 AI budget by the start of the second quarter. Microsoft cut off internal Claude Code access to trim operating expense. NVIDIA's own VP of applied deep learning put it plainly: "Our costs for my team have been more for AI than human." When the company selling the shovels says the shovels cost more than the diggers, pay attention.

Here is the part that should reframe how you plan. Every new user, every retry, every "let me also summarize that" feature is a metered inference call. Growth that would thrill a normal founder can quietly bankrupt an AI-native one. Swan's revenue was climbing. Its inference costs were climbing faster. Guess which one wins that race if nobody intervenes.

A flat subscription line beside a metered cost curve that rises with usageTwo cost shapes plotted against growth in usage, customers and features. A flat dashed line marks a SaaS subscription, fixed and forecastable no matter how much the product is used. A second line starts at the same place and curves steadily upward: AI inference billed per event. The shaded area between them widens the further right you go, so the more the product succeeds the larger the divergence becomes. Every additional user, retry and optional summary is a separately metered call.Two cost shapes, one growth curvemonthly costusage, customers, featuresSaaS subscription: fixed, forecastableAI inference: metered per eventEvery extra user, every retry, every “summarize that too” is a separate metered event.The gap is not a pricing problem. It is the shape of the cost.
The two lines start together. What separates them is not price per token, it is volume.

The shape is the problem, not the sticker price. You cannot negotiate your way out of a curve that steepens every time the product succeeds. You have to change what the product does per request. That is what LLM cost optimization actually is.

The five levers of LLM cost optimization, in the order that works

Strip away the branding and every credible LLM cost reduction technique falls into one of five layers. They are ordered by where they intervene, from the code that decides to call a model at all, down to the machine the model runs on.

The order is not arbitrary. Each lever cuts what the one before it left behind, which is why a team that starts at the bottom usually gets a disappointing result. Turning on caching for an agent that loops twelve times when it should loop three saves 90% of a number that should not exist.

A cost pipe narrowing through five successive optimization leversA wide pipe representing the starting monthly AI bill enters at the left and narrows in five stages, one per lever. The first stage, measurement, barely narrows the pipe because it reveals waste rather than removing it, dropping the cost index from 100 to 92. The second stage, fixing the application layer, produces the largest single narrowing to 60, because controlling agent loops and retries removes calls entirely. Model choice narrows it to 39, per-request technique such as caching and token discipline to 26, and deployment choice to 21. The pipe is widest at the left and thin at the right, showing that the levers multiply rather than add, and that each one only works on what the previous lever left behind.Where each lever bites1. Measurereveals the rest2. Applicationcuts 35%3. Model choicecuts 35%4. Per requestcuts 33%5. Deploymentcuts 19%1009260392621starting billwhat is leftEach lever only works on what the one before it left behind.They multiply. They do not add. Which is why the order is the strategy.
The widest narrowing is the second stage, not the fourth. Most teams start at the fourth.
Lever What it changes Typical saving Effort
1. Measurement Nothing directly. It tells you which of the other four to pull. 0% alone, unlocks everything One sprint
2. Application layer How many calls your product makes per user outcome 30% to 70% on agentic workloads Days to weeks
3. Model choice Which model handles each request 40% to 80% on eligible traffic Days, plus evaluation
4. Per-request technique What each individual call costs to serve Up to 90% on repeated context Hours to days
5. Deployment Whether you rent inference or run it Highly volume dependent Weeks, plus ongoing ops

The savings are ranges because they depend entirely on your workload. Once you have read the five, the calculator at the end of this section will apply them to your own numbers in this order.

If you arrived here with a bill that has already surprised you, and you would rather work backwards from the symptom than forwards from the strategy, start with why is my AI bill so high. It sorts the same causes by how often they turn out to be the one.

Lever 1. Measure cost per completed task

You cannot optimise what you cannot attribute. The single most common failure we see is a team with a five-figure invoice and no idea which feature produced it, so they optimise the workload they happen to remember rather than the one that is actually expensive.

The instrumentation is not complicated: wrap every model call so it records tokens in, tokens out, cached tokens, which model ran, and which feature asked for it. Then aggregate along the axis that matters, cost per completed task rather than cost per call.

That distinction is the whole discipline in one number. Cost per call flatters cheap models that fail and retry. Cost per completed task tells you what one finished user outcome costs, which is the figure that has to sit below what the user pays you. On every AI system we build at HorizonLux, that number goes in before the model choice does, because otherwise the model choice is a guess.

Instrument first, and the next three levers stop being a menu of tactics and become a ranked list. The exact fields to log, the join key that makes retries visible, and what "completed" has to mean before the number is comparable to anything are worked through in cost per task.

Lever 2. Fix the application layer: agents, RAG and chatbots

This is the lever teams skip, and it is usually the biggest.

The model is not what makes agentic software expensive. The loop around it is. An agent that takes twelve steps to finish a task does not send twelve small requests. It sends twelve progressively larger ones, because every step re-sends the entire conversation so far: the system prompt, the tool definitions, every prior thought, every tool result. Step twelve carries the weight of steps one through eleven.

One small bar for a single API call beside twelve growing bars for one agent runA single short bar on the left represents the token cost of one API call. To the right, twelve bars represent the twelve steps of a single agent run completing the same task. Each successive bar is taller than the last, because every step re-sends the accumulated conversation: the system prompt, the tool definitions, every prior thought and every tool result. The final step carries the weight of all eleven before it. The twelve bars taken together represent nineteen to fifty times the cost of the single call, and the growth is caused by context accumulation rather than by any step doing harder work.The same task, billed two waysSINGLE CALLONE AGENT RUN1 callstep 1step 12every step re-sends everything before itThe twelve bars together: 19x to 50x the single call, for one completed task.The tall bars are not harder thinking. They are the same conversation, paid for again.
Nothing in this picture is a model choice. It is all architecture.

The consequence is the single most misunderstood thing about agent economics: input spend scales with the square of the step count, not with the step count itself. Twice the steps means roughly four times the input bill, and a twelve-step run lands near seventy times a one-step call rather than twelve. None of that arithmetic cares which model you picked.

That is why an agent run routinely costs 19x to 50x a single completion (our own figure, derived from the token arithmetic in AI agent costs rather than taken from a published study), and why the same three controls come up on every engagement:

  • Iteration caps. A hard ceiling on steps per run that ends the run visibly, so an overrun surfaces as a handled error instead of a line on the invoice.
  • Circuit breakers. Detect the loop where the agent retries the same failing tool call with the same arguments, and stop it. This single pattern accounts for a large share of runaway invoices.
  • Context discipline, sometimes called context compaction. Do not carry the full transcript into step twelve if step twelve needs the last two turns and a summary. Trim, summarise, and drop tool results once they have been used.

Chatbots and retrieval pipelines have their own versions of the same disease.

Retrieval pipelines pay for context the model ignores. Fetching twenty chunks where four carry the answer bills the extra sixteen on every query, and it usually degrades the answer too, since the passage that matters ends up buried in near-misses. Turning top-k down is that rare lever that moves cost and quality in the same direction. The full arithmetic is in RAG cost optimization.

Chatbots pay for the whole conversation, forever. Every turn re-sends the entire session history, so a long support conversation gets more expensive per message the longer it runs, which is exactly backwards from what the user experiences. Summarising past turns beyond a threshold caps that curve.

The pattern behind all three is the same, and it is why this lever sits above model choice: change what the application sends, before you argue about which model receives it. A frontier model handling a lean request is often cheaper than a small model handling a bloated one.

Agents are the sharpest version of this, and the arithmetic behind the 19x to 50x figure is worked through in AI agent costs.

Lever 3. Right-size the model: small models, routing and fine-tuning

Only now does the model menu matter. Stop paying frontier prices for work a smaller, cheaper model can do. Most of what your product does all day is not hard reasoning. It is classification, extraction, routing, templated summaries, quick rewrites. Narrow, repetitive, boring. And you have been running all of it on a model built to write a legal brief.

This is backed by real research, not vendor decks. NVIDIA's 2025 paper, "Small Language Models Are the Future of Agentic AI," found that serving a small language model like Llama 3.1B can be 10x to 30x cheaper than its 405B sibling, in compute, latency and energy, for the narrow tasks that make up most agentic workloads. Under about 10 billion parameters, small models are frequently good enough for tool calls, structured output and routing steps. Sometimes they beat the big model, because a fine-tuned specialist outperforms a generalist on its home turf.

To make that concrete, here is roughly what the tiers cost. These are representative list prices across the major providers in mid-2026, rounded deliberately, because the exact number on your invoice depends on your provider and your contract.

Tier Input, per million tokens Output, per million tokens What it is for
Frontier around $3.00 around $15.00 Open-ended reasoning, multi-step planning, long-context synthesis
Mid-tier around $0.80 around $4.00 The default workhorse most products run on by habit
Small around $0.15 around $0.60 Classification, extraction, tool selection, templated rewrites
Cached input around 10% of the input rate not applicable Any stable prefix, on any tier
Batch around 50% of both around 50% of both Anything nobody is waiting on

Two things there matter more than the headline gap. Output costs four to five times what input costs on every tier, which makes response length a pricing decision rather than a style one. And small is roughly 20x cheaper on input than frontier, which is the arithmetic behind the routing argument below. The routing itself needs somewhere to live, and choosing between a managed router and a self-hosted gateway is its own decision with its own failure modes.

The architecture that ties this together is small-model-by-default, frontier-on-escalation. Your agent runs the cheap model on every step. A lightweight router watches for trouble, a low-confidence answer, a schema violation, a tool call that will not parse, and only then escalates that single turn to a frontier model. Most requests never leave the cheap lane.

A wide cheap lane carrying most requests with a thin branch escalating to a frontier modelA routing architecture drawn by width. Every inbound request enters a wide lane handled by a small model under ten billion parameters, covering classification, extraction, routing and templated rewrites at ten to thirty times lower cost per task. A router then inspects the result. Only when it sees low confidence, a schema violation, or a tool call that will not parse does a thin branch carry that single turn across to a frontier model. The wide lane and the narrow branch show the intended traffic split: the expensive path is the exception, not the default.Where each request actually goesEVERY REQUESTinboundSmall model, under 10Bclassification, extraction, routing, templated rewrites10x to 30x cheaper per taskrouter checks the answerlow confidence, schema violation, tool call will not parseFrontiermodelonly this turnA weak model that fails and retries three times costs more than one strong call.Route on cost per completed task, not on sticker price per million tokens.
The widths are the argument. The expensive lane is meant to look barely used.

One implementation note that catches teams out. Cheaper models are cheaper per token, but a weak model that fails and retries three times can cost more than one strong call. Route on measured success rate and total cost per completed task, not on sticker price per million tokens. That caveat is real but narrower than it sounds: it holds when the tiers are close in price and stops holding once the gap is wide, and small language models vs LLMs works out exactly where the line falls.

Fine-tuning belongs in this lever too, and it is arithmetic rather than philosophy. Training costs a fixed amount upfront; a tuned small model costs less per request. Divide the first by the second and you have the volume where fine-tuning pays back. Below that line prompting wins, above it tuning wins.

Small model vs frontier model: a working guide

Task Recommended tier Why
Classification, tagging, intent detection Small model (under 10B) Narrow and high-volume, cheap to fine-tune; frontier reasoning is wasted here
Data extraction into a fixed schema Small model (under 10B) Structured output is a specialist task; a tuned small model often beats a generalist
Routing and tool selection in an agent Small model plus router Runs on every step, so 10x to 30x cheaper compounds fast at agent scale
Templated summaries, quick rewrites Small model (under 10B) Bounded and repetitive; the quality gap is negligible on most product surfaces
Open-ended reasoning, multi-step planning Frontier model This is what you are actually paying frontier prices for
Long-context synthesis across many documents Frontier model, with caching A genuine capability need; cache the shared context to blunt the cost
Low-confidence or failed small-model output Escalate to frontier Pay the premium only for the fraction of turns that need it

The point is not to never use a frontier model. It is to stop using one for everything. LLM efficiency is not a property of the model you picked, it is a property of the match between each request and the model that serves it, and a cost effective LLM system is simply one where that match is right more often than not.

Lever 4. Make each request cheaper: caching, tokens and batch

With the right number of calls going to the right models, you can finally reduce what an individual call costs. Three techniques, all of them cheap to adopt.

Prompt caching. If your prompts share a fixed preamble, a system prompt, a rulebook, a long document, a few-shot block, you are paying full input price to re-read the same tokens on every call. Every major provider now bills cached tokens at roughly 10% of the standard input price, a 90% discount on the repeated portion. There is a small write premium the first time, so it only pays off above a modest hit rate, and it quietly breaks if a timestamp sneaks into your prefix. The mechanics, the per-provider pricing, the break-even math and a free calculator are all in the dedicated guide: prompt caching. If you run these models through AWS, the rules differ enough to break a working setup: see Bedrock prompt caching.

Token discipline. A 40,000-token context window feeding a question that needs 800 tokens of it is not thoroughness, it is waste with good intentions. Trim the prompt, cap max_tokens, ask for structured output instead of prose, and stop letting a chatty default temperature triple your output length. Output tokens usually cost several times what input tokens cost, which makes brevity a pricing decision, not a style one. Which tokens are actually worth cutting, and in what order, is in token optimization.

Batching. Every major provider discounts asynchronous work by roughly half. If a job does not need an answer in the next few seconds, and a surprising amount of production work does not, it should not be paying real-time prices. Nightly enrichment, backfills, evaluation runs, bulk classification: all of it belongs on a batch endpoint.

Stack the three and the repeated span of a prompt on a non-urgent job can end up costing well under 5% of what it started at.

Want to see whether caching actually pays for your workload? Our free prompt caching calculator models the request rate and the cache TTL together, which is where most estimates go wrong.

Lever 5. Decide where inference runs: self-hosting vs API

The last lever is the biggest architectural commitment and the one most teams reach for too early. Self-hosting an open-weight model removes the per-token price entirely and replaces it with a per-hour GPU price plus engineering time.

That trade only pays above a volume threshold, and the threshold is higher than it looks, because the honest calculation includes utilisation and people. A GPU billed by the hour costs the same whether it is at 90% load or 9%. Add the DevOps time to run serving infrastructure, handle model updates, manage failover and keep latency acceptable, and the break-even volume moves substantially further out.

Below that threshold, an API is cheaper and you should not be tempted. Above it, and especially with steady predictable load or a data residency requirement that rules out an API, self-hosting is the correct answer and it is a large, durable saving. The mistake is not picking either one. The mistake is picking without running the arithmetic. The break-even calculation, and the three costs that push it further out than the hourly rate suggests, are in self-hosting vs API.

Which lever is worth your next sprint

That is the full set. The order is the strategy, but the sizes are yours, so put your own workload in below. It applies the five levers in sequence rather than adding up percentages, because each one only bites on what the previous one left behind.

What does this workload do?

The model loops with tools. Every step re-sends the conversation.

Model calls it takes to finish one job.

Finished outcomes, not raw API calls.

Model tier you run today
Refine the inputs

System prompt, tools, fixed docs.

Genuinely new input each step.

Output usually costs 4x to 5x input.

Your rates, per million tokens

Representative mid-2026 list prices. Overwrite them with your actual rates.

Estimated now
$12,120/mo
$0.2424 per completed task · 3.2B input tokens/mo
After all five levers
$1,033/mo
$0.0207 per task · saves $11,087 (91%)

A best case. It assumes every lever lands cleanly and quality holds. Treat the first one or two as plannable and the rest as direction.

Start here
Fix the application layer

Biggest first move on your numbers: $4,877 a month.

Open the full diagnostic

The levers, in order, on your numbers

  1. 1Measure cost per completed taskno saving
  2. 2Fix the application layersaves $4,877/mo
  3. 3Right-size the modelsaves $4,106/mo
  4. 4Make each request cheapersaves $1,548/mo
  5. 5Decide where inference runssaves $556.18/mo

What each lever is actually worth

Every page on this topic quantifies its favourite lever and stays vague about the rest, usually because the author sells a product for the favourite. Here is the honest table, with the catch attached to each number, and each figure worked out in full in its own guide:

Lever Typical effect The catch
Measure cost per completed task 0% by itself Decides the order of everything below. Skipping it is why teams optimise the wrong workload
Fix the application layer 30% to 60% of the bill An agent run costs up to 25x a single call; no downstream lever can pay that back
Route to smaller models 40% to 70% of routed traffic Only safe where failure is detectable; the break-even success rate is about 1/N
Prompt caching up to 90% off the repeated prefix Goes negative below roughly 11,000 requests a month on explicit caching
Output discipline 30% to 50% of output spend Output bills 4x to 5x input, so small trims here outweigh big prompt trims
Batch non-urgent work flat 50% on eligible traffic A 24-hour window; the only lever with no quality trade at all
Self-hosting past break-even only Break-even sits near 800M tokens a month; below it the API wins

One boundary worth stating before you optimise against the wrong denominator: tokens are commonly only 30% to 50% of what an AI feature actually costs. The rest is engineering time, observability, evaluation, retrieval infrastructure and the people who keep it running. Everything on this page attacks the token half, which is the half that scales with usage and the half you can move this quarter. It is not the whole bill, and a lever that halves your tokens does not halve your feature.

Each lever’s savings percentage applied to a different slice of the billSix horizontal bars, one per cost lever, each showing its typical savings range. Beside each bar, a label states what the percentage actually applies to, and the bases differ on every row. Fixing the application layer removes thirty to sixty percent of the whole bill. Routing removes forty to seventy percent, but only of the traffic that routes. Caching removes up to ninety percent, but only of the repeated prefix. Output discipline removes thirty to fifty percent of output spend alone. Batch takes a flat fifty percent of eligible traffic only. Self-hosting saves nothing until volume passes break-even. The diagram shows why the percentages cannot be added together: each acts on a different denominator, which is why applying them in order multiplies instead.Same-looking percentages, six different denominatorsapplication layer30-60% of the whole billrouting40-70%, of routed traffic onlycachingup to 90%, of the repeated prefix onlyoutput discipline30-50%, of output spend onlybatchflat 50%, of eligible traffic onlyself-hosting0% until volume passes break-evenYou cannot add these numbers. Each acts on what the others leave behind.That is why order matters: applied in sequence, they multiply.
Every vendor quotes the biggest percentage. Almost none states its denominator.

Applied in order on a real system, these compounded to 79% in our own teardown, which is consistent with the 50% to 80% range reported across the industry. The order is why they compound: each lever acts on what the previous one left behind, so the percentages multiply instead of overlapping.

Three successive cost cuts shrinking a remainder bar, against the wrong arithmetic of adding the percentagesFour bars descending left to right. The first bar is the full bill at one hundred percent. A thirty one percent cut leaves sixty nine. A forty percent cut applied to that remainder leaves forty one. A forty eight percent cut applied to what is left ends at twenty one and a half percent, a seventy nine percent total reduction. Above the bars, the naive arithmetic of simply adding thirty one, forty and forty eight to claim one hundred and nineteen percent is shown struck through, because each lever can only act on the money the previous levers left behind. The diagram shows why the levers multiply rather than add, and why the order in which they are applied is part of the saving.Why the levers multiply instead of add31% + 40% + 48% = 119%?Each cut only acts on what the last one left.100%the bill69%after the loop-31%41%after routing-40% of the rest21.5%after caching-48% of the restThree moderate cuts compound to 79%. None of them could do it alone.
The wrong arithmetic promises 119%. The real number is 79%, and the order is what earns it.

Applying the levers to OpenAI and Anthropic

The five levers are provider-neutral, but the implementation is not. Each provider prices and behaves differently in ways that change what you should do first.

On OpenAI, caching is applied automatically to eligible prefixes rather than being something you mark, which means the optimisation is structural: order your prompt so the stable parts come first. The batch endpoint is a straightforward 50% discount, and the model tier ladder is wide enough that routing has real room to work.

On Anthropic, caching is explicit and you control it with breakpoints, which gives you more precision and more ways to get it wrong. The five-minute default TTL is the single most expensive Claude-specific mistake we see: teams enable caching, their traffic is spaced further apart than the window, and they end up paying the write premium repeatedly without ever collecting a read.

Same five levers, different first move. Working out which one applies to your stack is exactly what a cost review is for.

The full worked comparison, including the volume where each provider's caching starts paying and the case where the dearer model wins once configured, is in how to cut your OpenAI or Anthropic bill.

Most lists of LLM cost optimization techniques include these three. We rank them below everything above, on purpose, and it is worth being explicit about why.

Semantic caching. Matching queries by embedding similarity and replaying a cached answer bypasses the model entirely, which sounds like a 100% saving. It is also the only lever on this page that trades correctness for cost: a false-positive match returns last month's answer to this month's question, and "cancel my order" matches "cancel my subscription" more often than you would hope. Use it for FAQ-style, stable-answer traffic only, and treat it as a product decision rather than a cost setting. It is not the same thing as prompt caching, which never changes the answer.

Two different questions clearing a semantic similarity threshold and receiving the same cached answerTwo customer questions are shown side by side: cancel my order and cancel my subscription. Both feed into a similarity scale running from zero to one, which shows a match threshold set at zero point eight five and the measured similarity between these two questions at zero point nine one, clearing the threshold. Because the match succeeds, the second question is served the answer that was stored for the first. The answers required are completely different, one about a single purchase and one about a recurring plan, so the cached reply is wrong. The diagram shows that a semantic cache saves the entire model call and, unlike prompt caching, can change what the user is told.A 100% saving, and a wrong answer“cancel my order”“cancel my subscription”EMBEDDING SIMILARITYthreshold 0.85match 0.91clears the bar, so the model is never calledboth users get the order-refund replyone of them asked about a recurring planRaise the threshold and the hit rate collapses. Lower it and this happens more often.Every other lever on this page keeps the answer. Only this one bets on it.
The dial has no safe setting, only a chosen one. That makes it a product decision.

Fine-tuning for cost. The classic argument was that baking your few-shot examples into the weights stops you paying to send them. Prompt caching now bills those same examples at a tenth, so fine-tuning has to beat a 90% discount while carrying a training run, a higher hosted rate, and a re-train every time the base model moves. Fine-tune for behaviour, not for the bill.

Fine-tuning measured against cached few-shot examples rather than full-price onesThree stacked comparisons of the cost of sending few-shot examples on every request. The first bar shows the full price of those examples, which is the figure the classic argument for fine-tuning is measured against. The second bar shows the same examples served from a prompt cache at roughly one tenth of that price, which is what fine-tuning actually has to beat today. The third column stacks the recurring costs that fine-tuning adds on top of that much smaller target: the training run itself, a higher hosted inference rate, and a repeat of the whole exercise every time the base model is updated. The stack is visibly taller than the target it is meant to beat.What fine-tuning-for-cost is actually racingfew-shot examplesat full pricethe old argumentthe same examples,cached at ~10%the real targetwhat fine-tuning addsto reach itthe training runhigher hosted ratere-train on everybase model moveCaching already collected the saving fine-tuning was invented to collect.
The bar on the left is the one everybody quotes. The bar in the middle is the one you have to beat.

Switching providers. The move spans roughly 2x on comparable tiers, while configuring caching properly on the provider you already use spans 3x, without a migration. On our worked example, a cached Claude workload beat an uncached GPT one despite costing 2.4x more per token. Switch for capability or latency; optimise for cost.

The context moat: why cheap and defensible are the same problem

Cost control keeps you alive. It does not make you valuable. And in 2026 investors are drawing that line sharply.

The 2026 founder's guide from We Are Presta puts it bluntly: "The age of the 'wrapper' is over." A thin layer over someone else's API has no moat, because the foundation model can absorb your feature in a release note. What is defensible is what they call the context moat: owning the historical data, the user preferences and the industry workflows. The guide argues that ownership makes a startup far harder to displace than one that merely has a better fine-tune.

Read that against the cost problem and the two halves of the strategy click together. Your proprietary context, the workflow data, the labelled edge cases, the domain records nobody else has, is exactly what lets you fine-tune a small model that beats a generalist frontier model on your specific task. The moat and the margin come from the same asset. The teams that survive 2026 are not the ones with the best prompt. They are the ones who turned their private data into a cheap, specialised system that a $740-billion incumbent cannot trivially copy.

Proprietary data feeding both a cost advantage and a competitive moatTwo contrasting configurations. On the left, a thin wrapper sits directly on a frontier model API: it holds no data of its own, pays a generalist rate on every call, and can be absorbed by the model provider in a release note, so it is expensive and undefendable at the same time. On the right, proprietary workflow data, labelled edge cases and domain records feed two arrows at once. One arrow leads to a small specialised model that outperforms a generalist on this particular task at a fraction of the price. The other leads to a position a competitor cannot copy without the same records. The diagram shows that the margin and the moat are produced by the same asset, which is why the cost question and the defensibility question have one answer.Two ways to build the same featureTHE WRAPPERno data of its ownfrontier APIgeneralist rate, every callabsorbed in a release noteTHE CONTEXT OWNERworkflow data, edgecases, domain recordssmall specialisedmodelrecords nobodyelse hasthe marginthe moatone asset, both outcomesThe data that makes you cheap is the data that makes you hard to copy.
Two arrows out of one box. That is the whole strategy on a single page.

That same guide reports a quiet metric shift: founders now track cost per inference alongside CAC. Unit economics have moved inside the product. A feature that loses money on every call is not a feature. It is a liability with a nice UI.

This is also the honest test for whether you should build the thing at all. If your differentiator is the workflow rather than the data, an off-the-shelf tool usually wins on cost, and the cheapest inference is the call you never make.

How we arrived at this order, and how we build against it

Fair question to ask of anyone publishing a framework: where did the ordering
come from?

HorizonLux is a software development company that specialises in AI. We build
LLM applications and agent systems for clients, and we use AI across our own
delivery, so we sit on both sides of this problem: we design the systems that
generate these invoices, and we pay the ones our own tooling produces.

The order above is not a survey of the literature. It is the order we arrived
at by starting in the wrong place.
The instinctive first move on an expensive
agent is the lever with the biggest advertised number and the lowest effort,
which is caching. What you get is a real percentage off a bill that should never
have been that size in the first place. The saving only becomes worth having once
the loop above it is fixed. Do that a few times and you stop starting at the
technique and start starting at the architecture. That is what the five levers
encode, and why we insist on the sequence rather than presenting a menu.

So most of what follows ships as a default in what we hand over, rather than as
an optimisation we come back and retrofit:

  • Cost instrumentation goes in before the model choice. Every model call is wrapped so it records input, output and cached tokens, the model used, and the feature that triggered it. Cost per completed task is a dashboard on day one, not a retrospective.
  • Agents ship with a cap and a breaker. A hard iteration limit and a repeat-failure detector are part of the agent scaffold, not a hardening task for later. A missing cap gets discovered on the invoice, never in the logs.
  • Context is trimmed by policy. Tool results are dropped once consumed and transcripts are summarised past a threshold, so step twelve does not carry steps one through eleven whole.
  • Prompts are laid out cache-first from day one. Everything static leads, everything variable trails. Retrofitting that layout later means rewriting every prompt in the codebase, so we do it while there is only one.
  • Evaluation is measured in cost per completed task. When we compare a small model against a frontier one, the comparison includes the retry rate. A model that is cheaper per token and worse per outcome loses.

None of that is exotic. It is the difference between a system designed around
its invoice and one that discovers the invoice later, and it is most of what
LLM cost efficiency means in practice.

Your LLM cost optimization checklist

If you want to optimize LLM costs this quarter rather than read about it, work down this list in order. It is the same sequence as the five levers, which is what makes it an order rather than a menu.

  • Instrument first. Log cost per request and cost per completed task, tagged by feature, before you touch a single model choice. Everything below is guesswork without it.
  • Audit the loop, not the model. Count the calls one completed user outcome actually makes. If the answer surprises you, the application layer is your biggest lever and no amount of caching will fix it.
  • Cap and break. Put a hard iteration limit and a repeat-failure circuit breaker on every agent before it reaches production.
  • Move one high-volume, narrow task to a small model. Classification or extraction is the safest first move. Measure the quality gap. It is usually smaller than your fear of it.
  • Add a router. Small model by default, escalate on failure. This is the change that compounds.
  • Turn on prompt caching for any workload with a shared preamble, and check your TTL against your actual request spacing. The per-provider rules differ enough to change the answer, and they are worked through in how to cut your OpenAI or Anthropic bill.
  • Move non-urgent work to batch. Roughly half price for work nobody is waiting on.
  • Run the self-hosting arithmetic including utilisation and DevOps hours, then believe the result in whichever direction it points.
  • Name your context moat. Write down the proprietary data or workflow that a foundation model cannot replicate. If you cannot name it, that is the real problem, and it is bigger than your bill.

The $113,000 invoice is not a horror story about one reckless founder. It is a preview. The frontier-priced-everything era is closing because the people funding it ran the numbers. The teams that make it through are the ones who treat inference like the metered, variable cost it always was, and who own something upstream of the model that keeps them worth funding when the price of intelligence stops falling. Measure it. Fix the loop. Right-size the model. Cache the repeats. Guard your context. The bill is a design problem. Design for it.

Need the architecture, not just the advice? HorizonLux builds AI systems with cost per completed task instrumented from the first commit. See how we approach AI development, or tell us what your invoice looks like.

Frequently asked questions

What is LLM cost optimization?

LLM cost optimization is the practice of reducing what you spend on model inference without reducing output quality. It works across five layers: measuring cost per completed task, reducing how many calls your application makes per user outcome, routing each request to the smallest model that can complete it, making individual requests cheaper through caching and token discipline, and choosing whether inference runs on a provider's API or your own hardware.

What are the best LLM cost optimization techniques?

Ranked by how much they move the bill: cap agent iterations and trim carried context, route narrow requests to a small model with escalation on failure, cache the stable prompt prefix, batch non-urgent work, cut output length, and self-host once volume justifies it. LLM cost optimization strategies that open with a technique rather than a measurement usually disappoint.

How do I reduce AI costs without hurting quality?

Reduce the work before you reduce the model. Almost all quality loss comes from swapping a strong model for a weak one across the board. Almost none comes from removing a retry loop, trimming a transcript nobody reads, or caching a system prompt, so take those structural savings first: they are quality-neutral by construction. When you do change models, route rather than replace, and measure success rate rather than token price.

How do I reduce my AI costs quickly?

The quickest way to reduce LLM costs is prompt caching on any workload with a shared preamble: it ships in an afternoon and cuts the repeated span by about 90%. The largest win is almost always the application layer, capping agent iterations and stopping retry loops. Instrument cost per feature first, for a week.

What are AI inference costs?

Inference cost is what you pay each time a model produces an output, as opposed to the one-off cost of training it. Providers bill per million tokens, split between input and output, and output tokens are typically several times more expensive than input. Because every user action triggers its own inference call, this cost scales directly with usage, which is why it behaves like cost of goods sold rather than a fixed software subscription.

Is a cheaper model always cheaper?

No. Cost per token is not cost per outcome. A weak model that fails and retries three times can cost more than a single strong call, and it burns latency and engineering attention on top. Measure success rate and total cost per completed task, then pick the cheapest system that reliably finishes the job.

What makes an LLM system cost effective?

Cost efficiency is a property of the architecture, not the price list. A cost effective LLM system sends the fewest calls that finish the job, carries the least context each needs, meets each request with the smallest model that can complete it, and pays cache or batch rates where the work allows. Two teams on identical pricing routinely differ tenfold.

What is a context moat?

A context moat is the proprietary data a competitor cannot copy: your historical records, labelled edge cases, user preferences and industry-specific workflows. It matters twice over. It is what a foundation model cannot absorb in a release note, and it is what lets you fine-tune a small, cheap model that outperforms a general-purpose frontier model on your specific task. The defensibility and the margin come from the same asset.

Sources

Related articles

More on guides from the HorizonLux team.

Cut your AI bill without cutting quality

Five levers, applied in the order that works. Most bills are decided by the agent loop, not the model on the invoice.

Prefer email? [email protected]