LLM FinOps

AI Cost Optimization for Production LLM Systems

An engineering review of where your LLM spend goes, which changes are worth testing, and how to verify that each one lowers cost per successful task without lowering quality.

The problem

Where LLM spend comes from

Most LLM bills grow from a few compounding factors: oversized context on every call, one frontier model handling every request regardless of difficulty, retries and agent loops nobody is counting, and output that is longer than the task needs. Provider dashboards show totals by model and day, not cost per feature, per tenant or per successful outcome. Without that attribution, teams either cut blindly and lose quality, or stop cutting and accept the trend.

Signals you’ll recognize

  • The monthly LLM bill is growing faster than usage or revenue, and nobody can say which feature is responsible.
  • Every request goes to the same large model, including classification, extraction and routing steps.
  • System prompts, tool schemas and retrieved chunks are resent in full on every call, with no prompt caching in place.
  • Retries, timeouts and agent loops are not tracked, so failed attempts are invisible in unit economics.
  • Offline workloads such as backfills, evals and enrichment run on synchronous endpoints at full price.
  • There is no eval set, so any model or prompt change feels too risky to ship.

LLM cost problems are usually architecture problems that show up on an invoice. The same request pattern that resends a long system prompt, retrieves twenty chunks when three would do, and retries on every malformed JSON response will cost more each month as traffic grows, regardless of which provider you use.

We approach cost the way an SRE approaches latency: instrument first, set a baseline, then change one variable at a time against a fixed eval set. The unit we optimize is cost per successful task, not cost per token or cost per request, because a cheaper call that fails and gets retried, or that pushes work to a human reviewer, is not cheaper.

Typical levers we evaluate:

  • Provider prompt caching and stable prompt prefixes
  • Routing by task difficulty, with escalation to stronger models
  • Context and output budgets per step
  • Batch APIs for workloads that can wait
  • Retry policies, loop limits and fallback providers that do not double-bill

Every recommendation comes with the eval evidence behind it and the tradeoff it makes, so your team can decide what to ship.

What’s included

Token accounting and spend attribution

We break usage down into uncached input, cached input, cache writes, output and tool calls, then attribute it to features, endpoints and tenants using your logs, traces or gateway data.

Cost per successful task baseline

We define what success means for each workflow, then calculate cost per successful task including retries, failed attempts, fallbacks and human review, not just cost per request.

Model routing by task difficulty

We evaluate whether easier requests can go to smaller or cheaper models, using a classifier, heuristics or cascade with escalation, and measure the quality impact on your eval set.

Caching strategy

We review provider prompt caching (prefix structure, cache breakpoints, TTL, hit rate), exact-match response caching and, where safe, semantic caching with explicit staleness and correctness checks.

Context engineering

We look for context that does not earn its tokens: redundant instructions, unbounded chat history, too many retrieved chunks, verbose tool schemas and unconstrained output length.

Batch and asynchronous workloads

We identify jobs that tolerate delayed completion and can move to provider batch APIs, which are documented at a discount relative to synchronous calls.

Budgets, limits and spend observability

We recommend per-feature budgets, rate limits, max-token caps, loop guards and alerts so cost regressions are caught in hours rather than at invoice time.

What’s not included

  • Negotiating contracts, commitments or discounts with model providers on your behalf.
  • Reselling API capacity or acting as a billing intermediary.
  • Cutting cost by removing quality checks, safety controls or human review that your product depends on.
  • General cloud FinOps unrelated to AI workloads (storage, networking, non-AI compute).

How the engagement runs

Read our approach
  1. Step 1

    Instrument and baseline

    Collect token usage by type, request counts, retries, latency (p50/p95) and errors per feature. Where tracing is missing, we specify the minimum fields to log.

  2. Step 2

    Define success and build the eval set

    Agree on pass criteria per workflow and assemble a golden dataset from real, anonymized traffic so every change can be scored against the same baseline.

  3. Step 3

    Identify and size opportunities

    Rank candidate changes (caching, routing, context trimming, batch, output limits) by expected impact, implementation effort and quality risk.

  4. Step 4

    Test quality-cost tradeoffs

    Run the top candidates against the eval set and, where appropriate, a shadow or canary slice of traffic. Report cost per successful task, quality and latency side by side.

  5. Step 5

    Hand off the plan and guardrails

    Deliver a prioritized roadmap, regression gates for CI, budget alerts and dashboards so your team can keep the gains and catch regressions.

What we measure

Scoped engagement: deliverables, timeline and price are agreed in writing before work starts.

Cost per successful task
Total LLM, tool and retrieval cost for a workflow, including retries and failed attempts, divided by the number of tasks that meet the agreed success criteria.
Token mix
Share of uncached input, cached input, cache writes and output tokens per feature, taken from provider usage fields or your gateway logs.
Prompt cache hit rate
Cached input tokens divided by total input tokens on cache-eligible requests, tracked per endpoint and over time.
Retry and failure overhead
Cost of attempts that did not produce an accepted result (errors, timeouts, rejected outputs, loop aborts) as a share of total spend.
p50 and p95 latency
End-to-end latency per workflow measured from traces, so cost changes are not bought with unacceptable response times.
Eval pass rate
Share of golden dataset cases that pass, scored with deterministic checks, rubrics or model-graded evaluation calibrated against human review.

Examples

Hypothetical example

Support assistant resending a long system prompt

A support assistant sends a long, static system prompt and full tool schemas on every turn, followed by the conversation history. Restructuring the prompt so static content forms a stable prefix makes it eligible for provider prompt caching. The assessment would measure cache hit rate, cached versus uncached input tokens and p95 latency before and after, and confirm the eval set shows no quality change.

Hypothetical example

Extraction pipeline routed by difficulty

An internal pipeline sends every document to one large model. A small classifier is tested to send short, well-structured documents to a cheaper model and escalate the rest. Using illustrative round numbers, if 60% of 10,000 daily documents pass the cheaper path with equal accuracy on the golden dataset, the team can model the cost change and decide whether the added routing complexity is worth it.

What you receive

Spend attribution report

Where tokens and dollars go by feature, model and token type, with the data gaps we found.

Cost per successful task baseline

A reproducible calculation per workflow, with assumptions and the formula your team can rerun.

Prioritized optimization roadmap

Ranked changes with expected effect, effort, quality risk and the eval evidence behind each recommendation.

Eval set and regression gate

A golden dataset and pass thresholds you can run in CI before any prompt, model or routing change ships.

Budget and alerting specification

Per-feature budgets, token caps, loop guards and alert thresholds, ready to implement in your gateway or observability stack.

When this isn’t the right fit

We’d rather tell you before we start.

  • Teams spending very little on LLM APIs, where the engineering time would outweigh any plausible reduction.
  • Prototypes without production traffic, where usage patterns are not yet representative.
  • Teams that need a committed savings number before anything has been measured.
  • Teams that cannot share usage data, logs or a representative sample of requests, even anonymized.

Common questions

Will you guarantee a specific reduction in our LLM bill?

No. The achievable reduction depends on your traffic, prompts, quality bar and current architecture. We measure first, then estimate the effect of each change with evidence from your eval set, and you decide what to ship.

Do you need our API keys or production access?

No. We work from usage exports, logs, traces and anonymized request samples you choose to share. Any testing happens in environments and accounts you control.

Is switching to a cheaper model the main lever?

Sometimes, but often not first. Caching, context trimming, output limits and fixing retry loops can lower cost without changing the model. When routing to a smaller model makes sense, we test it per task type against the eval set.

How do you make sure quality does not drop?

Every recommendation is scored against a golden dataset built from your real traffic, using pass criteria agreed upfront. Changes that lower cost but fail the quality threshold are reported as rejected, with the data.

Are you tied to a specific model provider?

No. We have no commercial partnerships with model providers. We compare OpenAI, Anthropic, Google and open-weight options on your workload and keep your architecture portable where practical.

Review Your LLM Spend

In a short call we review your current spend profile and workloads, and tell you whether a scoped assessment is likely to be worth it.