Yasa

AI cost optimization: measure the cost of useful work

Precision balance illustrating AI cost optimization with one finished amber cube and the work behind it

AI cost optimization works best when you measure the cost of a useful result. A lower token price can still produce a more expensive workflow if it causes more retries, longer reviews or a lower acceptance rate.

First, choose a unit of work that matters to the product. Then connect its model usage, supporting services and quality checks. This guide explains how to compare changes without losing sight of what the system is supposed to deliver.

Define the outcome for AI cost optimization

A request is a technical event. A completed task is a product outcome. For example, a support-summary feature might count a summary only when a reviewer accepts it against a defined checklist.

The FinOps Foundation’s unit economics guidance connects technology cost to organizational value. For AI workloads, it describes moving beyond token-based units toward measures tied to useful outcomes. Choose a denominator that your team can explain and audit.

Also define the quality boundary. A summary may need to preserve the customer’s issue, avoid invented details and identify the next action accurately. Otherwise, an apparently cheaper system can improve its cost metric by delivering less.

Measure the full workflow

Attach usage to a task identifier so multiple calls and retries remain part of the same job. Record the model, input and output usage, cache activity, tool calls and outcome. Also include the execution services that support the workflow.

Keep human review effort visible. You can report it separately from direct operating cost, or include an agreed internal rate in a broader delivery-cost measure. However, do not silently switch between those definitions when comparing results.

Next, reconcile the usage records with actual provider billing. Published unit prices alone may not capture discounts, service tiers or every billable category. Preserve the currency and accounting period too.

A worked AI cost optimization comparison

Consider an illustrative batch of 100 support-summary attempts. These figures are invented to explain the calculation; they are not provider prices or a Yasa customer benchmark. Direct operating spend includes model and execution charges, while review labor is excluded.

MetricCurrentTrial
Spend€20€18
Passes8060
Per pass€0.25€0.30
A pass is a summary accepted against the same review criteria. These figures are illustrative.

The second scenario spends less in total. However, its lower acceptance rate makes each accepted result more expensive: €18 divided by 60 is €0.30. The baseline is €20 divided by 80, or €0.25.

Then inspect review time and the rejected cases. If the second scenario also needs more corrections, its total delivery cost may be worse again. A useful comparison keeps workload, acceptance criteria and cost boundaries consistent.

Reduce avoidable work before changing models

Inspect the expensive task traces first. Repeated retrieval, unnecessary tool calls and oversized context can consume resources without improving the result. For instance, a summary task may need a relevant message thread rather than an entire account history.

Shorten context carefully. Removing the requirement or the evidence needed for a correct answer can increase failures. Therefore, evaluate each reduction against the same representative cases.

Also set sensible limits on output length and repeated attempts. A concise answer that meets the requirement can be valuable. A truncated answer that hides a necessary qualification is a quality failure.

Use caching for genuinely reusable work

Prompt caching can reuse supported prompt prefixes. Anthropic’s caching documentation explains its product-specific controls and usage reporting. Verify actual cache reads and writes rather than assuming that a repeated request received a discount.

Keep stable instructions separate from changing task data where the provider’s mechanism supports that structure. Then measure the hit rate on your actual workload. Cache lifetime, model choice and prompt changes can affect reuse.

Application response caching needs a separate policy. Include the relevant model, prompt, data version and access context in its design. Also invalidate stale results and prevent one customer from receiving another customer’s cached content.

Route models by observed task performance

Test a lower-cost model on a representative set of tasks before routing production traffic to it. Include ambiguous and difficult cases, not only the examples used to design the prompt. Also inspect the failure types that matter to users.

A fallback can help when the first result fails a reliable check. However, include both calls in the task’s cost and latency. Escalating most tasks to a second model may erase the apparent saving from the first one.

Keep a permitted fallback for operational failures too. Decide whether a user should receive a delayed result, a clear retry message or a human handoff. That choice belongs to the product’s service expectations.

Separate interactive work from batch processing

Some tasks can wait. Overnight catalog enrichment and offline evaluation have different deadlines from an interactive support response. Google’s Gemini optimization guide distinguishes service tiers, caching and asynchronous batch processing for different workload needs.

Evaluate the available mechanism against the actual deadline and reliability requirement. Then include queue time in the measurement. Lower processing cost is useful only if the result still arrives when the product needs it.

For self-hosted inference, account for idle capacity and supporting operations as well as accelerator time. A busy benchmark does not describe the cost of a lightly used service over a full month.

Make AI cost optimization a controlled experiment

Change one major variable at a time and compare similar task groups. Record acceptance rate, direct cost per accepted result, review time and completion latency. Also inspect the slow or expensive tail; an average can hide a small set of runaway tasks.

  • Define the task and acceptance criteria before the comparison.
  • Preserve the same cost boundary and currency.
  • Include retries, fallbacks and failed attempts.
  • Check quality and latency alongside the cost change.
  • Keep a rollback route if the new workflow performs worse.

Finally, repeat the comparison when the workload, model or provider terms change. For implementation help, explore Yasa’s development and integration support. A useful first task is making one workflow’s cost and outcome visible.

Find the cost behind one useful result

Tell Yasa what your AI feature does, how you judge its output and where the spend is difficult to explain. We can discuss a focused measurement or implementation task.

Discuss your AI workflow with Yasa