Own Weights

How to cut your LLM API bill

Reduce LLM API costs by finding your priciest calls, cutting repeated prompt text, batching slow work and testing a smaller model on one task.

Updated

Part of: Cut your AI bill

An LLM API bill usually grows from a few calls that run far more often than anyone planned for. To reduce LLM API costs, find those calls, remove the waste around them, and only then test whether a smaller model can do the same job for less.

Find the calls that cost the most

List every AI call in your code. For each one, write down the model, the typical input and output size, and how many times it runs per day. Multiply those out.

Take a support tool that tags each incoming ticket. It runs 20,000 times a day with a 3,000-token prompt, most of which is a fixed instruction block and policy text, and it returns about 300 tokens. A nightly summary job runs 200 times with a 4,000-token prompt. The tagger sends nearly all of the input tokens, so halving the summary prompt saves almost nothing, while trimming the tagger’s instruction block saves a lot.

The open-source AI cost audit does this inventory from your code. It reads the repository on your own machine, makes no network calls, and produces a PDF of your AI calls, their models, estimated cost and problems such as calls with no timeout or API keys in code.

A common mistake is counting only the calls on your main path. Retries, background jobs and per-item loops often add up to more than the feature the team watches.

Cut the waste before you change models

  • Move repeated text to the front and cache it. Long instructions, policy text and reference documents get resent on every call. Prompt caching charges less for the part of a prompt that does not change. The saving depends on how much of each prompt repeats, and most providers set a minimum prompt size and a cache lifetime. Read prompt caching: what it saves and when it doesn’t before you count on it.
  • Batch work that can wait. Overnight re-tagging of old records does not need a reply in seconds. Batch processing costs less than real-time calls in exchange for a longer wait. Batch APIs versus real-time calls covers when that trade is worth it.
  • Cap the output. Output tokens usually cost more than input tokens. Set a maximum length on every call and ask only for the fields your code reads. A reply with twelve keys when the code uses three pays for nine keys nobody reads.
  • Stop paying for retries. A reply that fails to parse and gets sent again pays for the same work twice. Use structured output where your provider supports it, and log every failed parse with its task name.

Use a smaller model for one narrow task

A frontier model is built to handle any request. If your product sends the same narrow job thousands of times, such as pulling parties, dates and payment terms out of supplier contracts, a smaller model trained only on that job can be a better fit. On a public contract extraction exam, a model trained for that one task scored ahead of a frontier model given a single prompt and no examples. See full results for the scores and how they were measured.

The trade-off is scope. A trained model is good at the job it learned and little else, so it needs retraining when your document types or required fields change. Keep the general model for rare, open-ended requests and route only the repeated job to the smaller one. A common mistake is moving the whole product at once. Send a small share of traffic first and compare the results before moving the rest. Own Weights fine-tunes an open-weight model for one task, tests it against your current model on your data, and serves it in your own cloud account or on-prem.

Test on your own data before you switch

Public benchmarks do not show how a model handles your documents. Build the test yourself:

  1. Collect a few hundred real inputs from the last few months, including the messy ones.
  2. Write the correct answer for each, checked by someone who knows the domain.
  3. Score the model you use today. This is your baseline.
  4. Keep these items out of any training data and out of the prompt examples, or the score means nothing.
  5. Switch only when the other model beats the baseline on the same items. Read its errors, not only the average. A model that is right on average but misses every invoice in one currency is not ready.

How to test an LLM on your own data walks through the scoring step by step.

Compare cost per document, not per token

Per-token prices hide the real bill. The same text becomes a different number of tokens on each model, and a cheaper model that writes longer answers can cost more per task. Run the options on the same inputs and measure cost per document, ticket or record.

For one call, the cost is the input token count times the input price, plus the output token count times the output price. Multiply that by the number of calls each document needs. A document that needs three calls costs three times what a single-call estimate suggests. How LLM inference pricing works covers per-token rates and batch discounts.

Speed changes the bill too. A model that handles fewer documents per hour needs more capacity or a longer window to finish the same overnight batch. For a quick estimate of your current spend, use the LLM cost calculator.

A checklist before you change anything

  • Count calls per day for every AI feature, including background jobs and retries.
  • Trim the instruction text that repeats on every call, then cache what remains where your provider allows.
  • Move anything that can wait into batch processing.
  • Set a maximum output length and request only the fields you use.
  • Log parse failures by task name.
  • Score your current model on real data and keep that score.
  • Test one candidate on a small share of traffic, then compare cost per document.

Start with your largest task. Each step adds engineering time and complexity.

If you want to know which of your AI calls to move first, book a free audit. We map your AI spend by task from your code and invoices, then show which task is worth testing against a trained model. There is no charge to start.

Questions

How do I reduce my LLM API costs without hurting quality?

Start by finding the one or two tasks that drive most of the spend. Cut waste first with caching, batch processing and output limits. Only then test a smaller model on that task, and switch only if it scores at least as well on your own data.

Is prompt caching worth it?

It helps when a large part of each prompt repeats, such as a long system prompt or reference text. It helps little when every prompt is different. Check your provider's minimum size and discount rules before you rely on it.

Can a smaller model really replace a frontier API for my task?

It can, for a narrow and repeatable task with clear right answers. Build a test from your real data, score the current model first, and compare the two on that test. General benchmarks will not tell you how the model does on your documents.