How a Call Is Billed
Input, output, and cache are priced differently — by several times. Read the price sheet before choosing a model.
Most teams' first AI bill arrives with the same reaction: "why is this so expensive?" Usually because they picked a model by its output price and never priced the whole call. The cost of one call comes down to a single formula.
Symptoms you'll recognize:
- The price sheet has a dozen numbers and you can't tell which part each maps to.
- You budget by "price per answer," then blow the budget after launch.
- Two models differ slightly in unit price, you pick the cheaper one, and the bill is higher.
The one-line formula
Cost of one call = input tokens x input price + output tokens x output price.
Input is everything you send: system prompt, conversation history, retrieved documents, and the user's question. Tokens aren't word counts, and Chinese, English, and long code all shift the count.
Output is the model's generated answer. Note: output usually costs 3 to 5 times more than input in most vendors' pricing structures.
The value of this formula is knowing exactly which two buckets your money goes into. To save, you either cut input volume or cut output volume — and the methods for each are completely different.
Three prices
- Input price. The cheapest tier. System prompt, history, and retrieved material all bill here. If your prefix hits cache, it gets even cheaper.
- Output price. The most expensive tier — the answer itself. This is why "ask the model to analyze" costs far more than "ask it yes or no": the former generates a lot of text.
- Cache price. Many vendors offer a discounted rate for repeated input prefixes, as low as a tenth of the input price. It's the biggest lever for saving money, covered in the article on cache hits and savings.
Vendors differ mostly in these three numbers; the formula structure is shared. Some also offer batch pricing (offline tasks, much cheaper but slower) and free credits. When choosing a model, don't look at a single price — compute the blended unit price for your actual call mix.
How to compare models
The right way to compare two models isn't "which unit price is lower" but "which total cost is lower on the same batch of real requests." Steps:
- Estimate your input-to-output ratio. A support scenario has large inputs (system prompt + history + knowledge base) and small outputs; a writing scenario is the reverse. The same model's blended cost can differ several-fold between the two.
- Watch output length differences. A cheap model can be chatty — it outputs 50% more tokens for the same question. A low unit price isn't a low total price. Constraining the output format often beats switching models.
- Factor in caching. Whether your call structure is stable decides whether you can use the cache discount. Calls with a stable prefix may cost far less than the price sheet suggests.
One sentence: compare the bills two implementations produce on the same task, not the numbers on the price sheet.
Estimating your budget
Before launch, this rough math is enough:
Per-call cost = (average input tokens x input price + average output tokens x output price) x (1 - cache hit rate x discount).
Then: monthly cost is about per-call cost x daily calls x 30.
Two things people miss:
- Don't underestimate input. In agent scenarios, every call's input includes the full history, and after many loop rounds the input can balloon to thousands of tokens. Budgeting at "100 tokens average input" misses by an order of magnitude.
- Leave room for retries and debugging. Development, eval, and failed retries all generate extra calls. Keep a 20–30% buffer in the budget.
Last piece of advice: log your billing. Record input and output token counts per call and aggregate by day. Without this data your budget is always a guess; with it, you can optimize AI cost the way you'd optimize any operational metric. Exact prices change often — check the vendor's current official pricing page. claude-pricing
