How to Reduce LLM API Costs by 60% Without Losing Quality

Most teams meet their first surprise LLM bill the same way: the invoice is two or three times the forecast, and nobody can say which feature spent it. There is no single switch that fixes this. There is a stack of six levers, and they multiply. This is the complete guide to each one, in the order that pays off fastest, with the measured savings range for every lever and where routing, the single largest one, changes what the next request costs before it is ever sent.

Published 2026-07-14 by Dor Amir on the Nadir blog.

Filed under Nadir & Alternatives.

The bill that arrives three times the forecast

The most common way teams first take LLM costs seriously is the same story every time. The API invoice lands at two or three times what the model was supposed to cost, finance asks which feature spent it, and nobody can answer, because the tokens were never attributed to anything. There is no single setting that fixes this. There is a stack of six levers, and the important thing about them is that they multiply. Cut input tokens 30% and route half your traffic to a model a fifth of the price, and you have not saved 30%, you have saved much more, because the discounts compound on the same requests.

This is the complete guide to the six levers, ordered the way you should actually apply them: measurement first, then the changes ranked by return on effort. For each one you get the realistic savings range and a link to the deep dive if you want the mechanics.

Lever zero: you cannot cut what you cannot see

Before any optimization, you need per-feature cost attribution. Not a monthly total, a breakdown: cost per endpoint, per user action, per agent run. The reason is that LLM spend is almost never uniform. A single feature, a single retry loop, a single oversized system prompt usually accounts for the majority of a surprising bill, and you cannot find it from an aggregate number.

The FinOps discipline caught up to this in 2026: 98% of FinOps teams now manage AI spend, and most still cannot see where the tokens go. The fix is boring and non-negotiable. Log tokens in and out, model, and cost on every call, tagged with the feature that made it. Datadog's own telemetry found 69% of tokens were going into system prompts that most teams never inspected. You will not believe where the money goes until you measure it, and you will not measure it by accident.

Once you can see the bill, apply the levers below in order.

Lever one: route each request to the cheapest capable model

This is the largest single lever, and the one most teams skip, because the default behavior of every SDK is to send every request to whatever model you hard-coded, usually the best and most expensive one. But most requests are not hard. Meta's RouteLLM work found 74% of GPT-4-class calls did not need a GPT-4-class model to get the same answer. You are paying frontier prices for a workload that is mostly easy.

LLM routing is a decision layer that reads each request, estimates its difficulty, and sends it to the cheapest model that can still answer it well. The critical detail is verification. A router that guesses the model before seeing an answer is dead reckoning, and it ships bad responses when it guesses wrong. A verified router lets the cheap model answer, scores that answer with a calibrated verifier, and escalates only on a reject.

That distinction is the difference between routing that measures quality and routing that assumes it. A reference-assisted RouterBench research experiment projected 60% lower cost at about 98% retained quality, but the verifier had the expensive reference answer unavailable in production. Treat it as a research ceiling. Customer decisions should begin with a declared baseline, shadow traffic, and outcomes.

Estimated saving: 40 to 60% on a mixed workload.

Lever two: stop resending the same tokens uncached

Agents and chatbots resend the same large prefix on every turn: the system prompt, the tool schemas, the retrieved documents, the conversation so far. Provider prompt caching lets you pay a steep discount on that repeated prefix instead of full price every time. OpenAI and Anthropic both discount cached input tokens sharply, and for a workload with a big stable prefix that is close to free money left on the table.

Two adjacent techniques stack on top. Semantic caching returns a stored answer when a new request is similar enough to a past one, skipping the model call entirely. And on self-hosted fleets, routing across the KV cache instead of blind round-robin avoids recomputing context that already lives on a replica, a gap that produced a measured 170x swing in time-to-first-token on identical hardware.

Estimated saving: 30 to 50% of input cost on cache-heavy workloads.

Lever three: cut the input tokens you actually send

Caching discounts the tokens you resend. This lever removes tokens you never needed to send at all. The usual offenders:

Estimated saving: 15 to 40% of input cost.

Context selection: the version of this lever we measured

Of everything in that list, one operation is worth spelling out, because it is the only one that reliably removes billed tokens instead of fighting the tokenizer. Character-level tricks do not work: we tested dropping letters, gzip, and base64, and every one made text more expensive, because a mangled word usually costs more sub-word tokens than the intact one did. What works is dropping whole passages the request does not need.

That is context selection, and it runs like this per request:

  1. Take the query. The latest user message is the question. It is never pruned, and neither is the system prompt.
  2. Find the big blocks. Only retrieved context and tool output above roughly 800 characters are eligible. Parseable JSON is skipped so tool results stay loadable.
  3. Split at boundaries. Each block splits into chunks on natural breaks. Kept chunks survive byte for byte, nothing is rewritten or summarized.
  4. Score against the query. Chunks and query are embedded and scored by relevance. The encoder is the whole ballgame: a lexical word-overlap scorer saved more tokens and failed the quality gate at a 12.1% regression rate, and a semantic embedding model dropped that to 1.4%.
  5. Keep the top fraction, then apply the guards. The lead and tail chunks always survive, safety and policy language is never dropped, and any chunk carrying a rare term from the question is pinned. That last guard is why the answer paragraph survives even at tight budgets.
  6. Collapse the rest. Dropped runs become a single marker line, so the model can see something was omitted rather than silently missing it.

Measured on HotpotQA at a keep ratio of 0.6, with every answer graded blind by an independent judge against the known-correct answer:

HotpotQA gate, keep 0.6~4K context~12K context
Input tokens removed31.8%34.1%
Answer paragraphs kept100%100%
Accuracy, full context97.2%94.8%
Accuracy, selected96.0%95.9%

On the largest contexts the answers got better while a third of the tokens left, because long noisy context degrades a model by itself and selection removes distractors along with the bill. That is the shape of this lever at its best: on exactly the bloated-retrieval traffic where the savings are largest, quality does not have to be the thing you trade.

It ships as an opt-in Nadir optimize mode, "optimize": "select", with an interactive walkthrough of the algorithm on the context optimization page, the full method and failure cases in the benchmark writeup, and the algorithm itself open source as barber-llm.

Lever four: bound the output

Output tokens usually cost several times more than input tokens, so an unbounded response is the most expensive kind of waste. Cutting output tokens is often the cleanest win on the bill, and it comes from a few habits: set a sane max-tokens ceiling, ask for terse structured answers instead of prose, and watch two silent inflators. Structured JSON output carries a token tax from the syntax itself, and extended thinking or reasoning tokens are billed as output even though the user never sees them, so leaving reasoning on by default for easy requests quietly multiplies their cost.

Estimated saving: 10 to 30% of output cost.

Lever five: batch what does not need to be real time

Any workload that is not user-facing in real time (evaluations, enrichment, backfills, nightly summarization) should go through the batch API, where OpenAI and Anthropic both offer roughly a 50% discount in exchange for asynchronous completion within a time window. This is a pure config change for the eligible traffic, with no quality tradeoff, and most teams have more batch-eligible work than they think once they separate it from the interactive path.

Estimated saving: up to 50% on batch-eligible traffic.

The stacked math

The point of ordering these is that they compound on the same requests. A worked example on a workload that starts at $10,000 a month:

StepLeverApplied toRunning bill
Startnone$10,000
1Route 60% of traffic to a model ~5x cheaperall interactive$5,200
2Cache the repeated prefixcache-heavy input$3,900
3Trim system prompt and tool schemasall input$3,300
4Bound output lengthall output$2,900
5Move evals and backfills to batch~15% of volume$2,600

That is a 74% reduction, and none of it required a worse model on the hard requests, because the router kept the frontier available for the traffic that needed it. Your real numbers will differ, but the shape holds: the levers multiply, and routing does the heaviest lifting.

What routing looks like in code

The reason routing is the highest-leverage lever is also that it is the lowest-friction to adopt. A routing gateway that speaks the OpenAI API format is a base-URL change, not a rewrite:

import openai

client = openai.OpenAI(
    base_url="https://api.getnadir.com/v1",
    api_key="ndr_...",
)

response = client.chat.completions.create(
    model="auto",  # cheapest model that can handle this specific request
    messages=[{"role": "user", "content": prompt}],
)

Nadir can use the same OpenAI-compatible call shape for hosted execution, or return a decision beside the gateway you already run. Start in shadow mode, declare the comparison baseline, and attach actual outcomes. Complete non-streaming responses can optionally enter the verifier; streaming bypasses it, and decision-only projected savings stay advisory.

Where to start this week

Conclusion

There is no one switch, and anyone selling you one is selling a cap, not a cut. A spending cap limits how many requests run, not what each one costs, and it fires after the model already billed at full price. The bill drops when the unit cost of the next request drops, and that comes from the stack: measure, route, cache, trim, bound, batch. Routing is the largest lever because it is the only one that changes the price of a request before it is sent. The rest discount what is left. Applied in order, on the same traffic, they routinely more than halve a bill without a worse answer on the work that mattered.

Related reading


This guide links first-party Nadir benchmarks and cited third-party research throughout. The 60% / ~98% figure is a reference-assisted research ceiling on 11,420 RouterBench triples, not deployed performance or a typical customer outcome.


More on nadir & alternatives

What Nadir is

Nadir is an LLM router. Nadir sizes every prompt and routes it to the cheapest model that still clears your quality bar. A small decision model reads each prompt against your model menu and picks the lowest-cost model it expects to handle it. When the decision model is uncertain or unavailable, the request goes to the strongest model on the menu. The routing step makes no call to your model provider.

Nadir runs two ways. The decision API returns a model, reasoning-effort, cache, context, and policy recommendation without calling a model provider, beside the gateway you already run. That is how a shadow-mode evaluation works, and its projected savings stay advisory. The OpenAI compatible managed proxy executes the route, and migration is a two-line change: point the base URL at api.getnadir.com and set model to auto. On that path an optional verifier can score a complete non-streaming answer and escalate to a stronger model when it misses the configured bar. Streaming bypasses post-generation verification. BYOK is supported on every tier.

For coding agents, Nadir Auto is a terminal launcher for Claude Code or Codex that asks Nadir for the main-session model before each turn, with your configured model as the fallback and cost ceiling. Delegation integrations for Claude Code, Codex, or Cursor instead recommend a model tier for subagent work, and the agent decides. Either way inference runs on your own provider account, so Nadir holds no provider keys on that path.

What the numbers are, and what they are not

Nadir publishes each evaluation with its scope. On checkable code, run-check-escalate solved 392 of 395 common HumanEval and MBPP problems (99.2%), graded by running the canonical tests; that applies only to tasks with runnable deterministic tests. Nadir-Tumbler posts an arena_score of 72.3 on RouterArena's public scorer, 5th of 23 routers, which measures the routing decision on RouterArena's own model pool. A reference-assisted RouterBench evaluation over 11,420 held-out triples produced a 60% lower projected cost than always-Opus with about 98% retained quality and a 1.7% catastrophic-route rate. That experiment gave the verifier the expensive-model reference answer, which production does not have, so it is a research ceiling and not the deployed path.

None of these is a production guarantee, a universal savings rate, or a forecast for any particular workload. Customer savings are reported from measured execution against a declared baseline, and customer quality only from outcome-labelled traffic. Projected savings and realized savings are separate artifacts and are never blended.

Design-partner program

Three rungs, picked by risk appetite. Rung 0 Shadow runs advisory decision calls alongside live traffic and returns a projected receipt, with nothing in the request path changed. Rung 1 Hosted is the two-line swap on a production slice and returns a realized receipt. Rung 2 On-prem is a supervised six-week proof of concept inside the partner's VPC, where no prompt, response, or usage reaches Nadir. The commitments are the same at every rung. Apply for a rung directly: Rung 0 Shadow, Rung 1 Hosted, or Rung 2 On-prem. Not sure which fits? Start at getnadir.com/contact/?reason=design-partner.

Licensing

NadirClaw is the self-hosted core, source-available under the PolyForm Noncommercial License. Source-available is the correct label; NadirClaw is not open source. Nadir Route's hosted plan has no base fee and charges a variable fee only on measured savings from requests Nadir executed.

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.