1. Build a cost baseline by workload

Start with a week of representative requests grouped by product workflow: support classification, document extraction, coding assistance, research, or content generation. Record input, cached input, output, retries, tool calls, model, latency, and whether the result passed review.

Calculate cost per successful task. Unit prices alone cannot reveal that a smaller model retries twice or that a verbose workflow adds expensive output no user reads. Keep interactive and offline workloads separate because their latency requirements lead to different optimizations.

  1. Choose three to five high-volume workflows.
  2. Capture at least a representative sample for each model and route.
  3. Mark success using a test, reviewer decision, or product outcome.
  4. Rank opportunities by total monthly cost, not by the largest percentage discount.

2. Move non-urgent work to batch processing

OpenAI and Anthropic publish discounted batch processing for work that does not need an immediate response. Good candidates include nightly classification, evaluation runs, catalog enrichment, and document backfills. User-facing chat, live coding, and synchronous validation usually belong on real-time endpoints.

Design batch jobs to be restartable. Store a stable request ID, validate outputs before publishing them, and retry only failed items. A discount disappears quickly if a malformed batch must be rerun in full.

  • Batch only workloads that can tolerate the documented completion window.
  • Split very large jobs into auditable chunks.
  • Validate schemas and model availability before upload.
  • Reconcile batch output IDs to the original records before downstream use.

3. Cache repeated context—after measuring reuse

Prompt caching is valuable when a large, stable prefix appears across many requests: a system policy, tool schema, codebase briefing, or reference document. Put stable material first and changing user input later so the provider has a reusable prefix. Then monitor cache reads and the effective cost per request.

Caching can cost more for one-off work because writes may carry a premium and never receive a hit. Estimate the break-even number of reads using the provider’s current write and read rates. Also review data-retention implications before enabling extended caching for sensitive workloads.

4. Route by task and cap output

Use the least-expensive model that meets a written quality threshold for each task. A compact model may handle classification and extraction while a frontier model handles ambiguous reasoning. Route escalation from an observable signal—confidence, validation failure, or task type—not from a random percentage.

Set an output ceiling appropriate to the artifact. Ask for structured fields when the product needs fields, a patch when it needs a patch, and a concise explanation only when a human will read it. Very low caps can truncate results and create retries, so test them against long-tail cases.

  1. Create a small evaluation set with normal and difficult examples.
  2. Test a lower-cost model and define the failure conditions that trigger escalation.
  3. Set the output cap slightly above the longest accepted result in the evaluation.
  4. Measure total cost including retries and escalations before rollout.

5. Remove hidden waste from retries and context

Repeated instructions, full conversation replays, duplicated documents, and unconstrained retry loops often create more waste than the model choice. Summarize durable state, send only relevant retrieval results, validate locally when possible, and stop retrying after a known number of attempts.

Log why a retry happened. A transient provider error, invalid JSON, insufficient context, and a weak prompt require different fixes. Blindly changing the temperature or resending the same request spends money without adding information.

  • Deduplicate retrieved passages before constructing the prompt.
  • Use schema validation and targeted repair instead of regenerating a whole response.
  • Keep conversation summaries separate from raw history and refresh them intentionally.
  • Set retry counts, backoff, and maximum total cost per task.

6. Verify savings with quality and privacy checks

Compare the new workflow with the baseline using cost per accepted result, latency, error rate, reviewer time, and data-handling requirements. Roll out one change at a time so the effect is attributable. A cheaper bill paired with slower users or more production incidents is not a win.

Review provider evidence whenever prices or models change, then update the calculator with the observed token mix. Keep an explicit rollback path for every routing, caching, and batch change.

MetricWhy it matters
Cost per successful taskIncludes retries and quality failures that token price misses.
Cache hit rateShows whether write premiums are being amortized.
Escalation rateReveals whether a lower-cost first model is actually efficient.
P95 latencyProtects the user experience during routing changes.
Human review minutesCaptures cost shifted from inference to people.