How to compare LLM API costs honestly (a developer's checklist)

Last updated · Written by Nova

Nov 19, 2026 · #pricing#billing#developers

The honest way to compare LLM API costs is to replay one fixed set of your own requests on each provider and compare the billed total — not the per-token unit price. A unit price says nothing about your bill until your workload is pinned down. This page is a buyer's method, not a price list.

Unit prices are easy to publish. They are hard to use. The reason is arithmetic: your bill is a sum of several metered quantities, each with its own rate. Change the mix and the ranking changes.

Why per-token comparison breaks

A single token price assumes every token costs the same. Real invoices separate input tokens from output tokens. Output is usually billed at a higher rate than input. A chatbot with long answers and a classifier with one-word answers can move the same number of total tokens and produce different bills.

Caching splits input further. Repeat prompts can be billed at a reduced rate when a provider supports prompt caching. A raw unit price does not tell you whether the cache hit happened.

Reasoning modes add a third variable. A thinking model generates internal tokens before the visible answer. Those tokens are metered. Two models compared at different reasoning settings are not the same workload.

A lower sticker price can still produce a higher bill. The only reliable number is the cost of your own request set, measured end to end.

Define the workload first

Fix these variables before you read any price page. If a variable moves between providers, the comparison is void.

VariableWhat to hold constant
Input/output mixSame prompts, same expected answer length, same max-token setting.
Cache behaviorSame repeat rate, same cache prefix, same cache window.
Reasoning modeSame mode on/off setting, same effort level where the option exists.
Request shapeSame message count, same tools, same streaming flag.
Measurement windowSame time span and same number of requests on each provider.

Write the workload down as a file. A saved JSONL of real requests is the cleanest form. It makes the test repeatable and the result auditable.

The comparison checklist

  1. Export a request sample. Take 100 to 500 real requests from your logs. Include the long tail, not only the easy ones.
  2. Freeze the settings. Fix max tokens, temperature, tools and reasoning mode in the sample file.
  3. Replay on each provider. Send the identical file to each endpoint. Record the usage block from every response.
  4. Record four numbers. Input tokens, output tokens, cached input tokens and the billed amount for the whole set.
  5. Normalize the result. Divide total billed amount by the number of requests. That is your cost per request under your own workload.
  6. Repeat on a second day. Cache state and load patterns change. A one-shot test can mislead.

How to read the usage block

Most OpenAI-compatible APIs return a usage object with the response. Parse it instead of estimating from string length. Token counts from the server are the counts you are billed on.

{
  "usage": {
    "prompt_tokens": 812,
    "completion_tokens": 196,
    "total_tokens": 1008,
    "prompt_tokens_details": {
      "cached_tokens": 640
    }
  }
}

Keep the raw responses. A spreadsheet of per-request usage is enough to compute every ratio in this article. Do not round until after the total is summed.

Two worked shapes

Consider two hypothetical workload shapes with the same token price. Shape A sends 2,000 input tokens and produces 100 output tokens. Shape B sends 200 input tokens and produces 900 output tokens. Because output is billed at a higher rate, B costs more per request even though both are 2,100 tokens in total.

Now add caching. If Shape A repeats the same 1,800-token prefix on every call and the provider bills cached input at a reduced rate, A's bill drops again. The ranking can invert without any price change. This is why a list of per-token rates cannot answer the question.

Never compare a cached workload to an uncached one. Enforce the same prefix and the same repeat count on both sides, or discard the result.

Questions people actually ask

Why is comparing per-token prices misleading?

A unit price ignores how many input and output tokens a workload actually uses. Two requests can have the same token count and very different costs. The bill depends on the mix, not the sticker.

What does same-workload comparison mean?

It means sending the same prompts under the same settings to each provider, then comparing the billed cost of that identical request set. Input/output mix, cache behavior and reasoning mode stay fixed across runs.

How much does the input/output ratio change the bill?

Output tokens are typically billed at a higher unit rate than input tokens. A workload that produces long answers therefore costs more per request than a classification workload with short outputs, even at the same token price.

Do cached tokens change the comparison?

Yes. Prompt caching can bill repeat input at a lower rate. If one provider caches and another does not, raw unit prices will not predict the bill on repeated prompts. Measure cache hits on your own traffic.

Why does reasoning mode matter for cost?

Reasoning modes generate extra tokens before the visible answer. Those tokens appear in usage and are billed. A model compared at its fastest setting may cost more in a thinking mode, so keep the mode identical across tests.

How do I measure my real API cost?

Replay a saved set of your own requests against each provider. Record input tokens, output tokens, cache hits and the billed amount for the same set. Divide the total by the number of requests to get your own cost per request.

Reference

Billing units and token definitions: https://api-docs.deepseek.com/quick_start/pricing