Safeguard
Developer Tools•

How to estimate a monthly LLM API bill: a worked example

A step by step method to estimate a monthly LLM API bill, with a worked example using dated public prices and the effect of caching and batch discounts.

Safeguard Security Team
3 min read

To estimate a monthly LLM API bill, multiply requests per month by average input and output tokens, convert to millions, and apply the model's per million prices. A support bot with 50,000 requests of 1,500 input and 300 output tokens costs about $300 a month at one public mid tier price list.

Step 1: write down the shape of one request

You need four numbers per feature: requests per month, average input tokens, average output tokens, and the share of input that repeats (system prompt, tools, shared documents). Pull them from a week of logs if you have a prototype, or count sample requests with the provider's token counter.

Step 2: pick the price list

This example uses Anthropic's published price for Claude Sonnet 5.5 on 19 October 2026: $2 per million input tokens, $10 per million output tokens, and $0.10 per million for cache reads. The point is the method. Swap in your own model and re-check the page before you commit to a number.

Step 3: do the arithmetic

Assume 50,000 requests a month, 1,500 input tokens and 300 output tokens per request.

  • Input: 50,000 times 1,500 is 75 million tokens. At $2 per million, that is $150.
  • Output: 50,000 times 300 is 15 million tokens. At $10 per million, that is $150.
  • Total: $300 a month.

Step 4: apply caching

Say 1,000 of the 1,500 input tokens are an identical system prompt and reference text. If nearly every request reads that prefix from cache:

  • Cached input: 50 million tokens at $0.10 per million is $5.
  • Uncached input: 25 million tokens at $2 per million is $50.
  • Output is unchanged at $150.
  • Total: $205 a month.

This ignores cache write charges and misses, which add cost. Anthropic lists a five minute cache write at 1.25 times the base input price. Real savings will be lower than the clean number. See prompt caching explained.

Step 5: apply batch where it fits

Anthropic's documentation lists a 50 percent discount on input and output tokens for the Batch API, and says it can combine with caching. If the work can wait, such as nightly classification, the original $300 would be about $150 before caching effects. A live support bot cannot wait, so batch does not apply to it.

Step 6: add a margin for reality

Real bills run above clean estimates. Add room for:

  • Retries and failed calls.
  • Conversations longer than your average.
  • Tool definitions and tool results, which count as input.
  • Extended thinking, billed as output on models that use it.
  • A newer tokenizer if you migrate. Anthropic says its newer tokenizer produces about 30 percent more tokens for the same text.

A common habit is to budget the estimate plus a buffer, then review actual usage weekly for the first month.

Quick check

Do I need to be exact?

No. You need the right order of magnitude and a plan to check actual usage. Estimates at this stage are usually off by tens of percent.

What is the biggest source of surprise?

Usually long conversations and agent loops, where earlier context is resent on every step.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.