BroadRouter
Get started

How to estimate LLM API cost before you launch a feature

By the BroadNet Inference team · 6 min read · Published · Updated

Estimate LLM API cost by modelling one user action, not one API call: count calls per action, measure input, cached and output tokens per call on real samples, then multiply by users and actions per month. Add reasoning and retries, and price low, expected and high scenarios. Our worked example on DeepSeek V4.1 Flash comes to $42.67 a month.

To estimate LLM API cost before launch, price one user action rather than one API call. Count the calls behind it, measure new input, cached input and output tokens on 20 to 50 real samples, multiply by monthly actions, then add reasoning and retries. Our worked support-reply example on DeepSeek V4.1 Flash comes to $42.67 a month.

It is a pre-launch forecast for one feature; once you have paying users, LLM cost per user for SaaS covers margins and pricing tiers.

What is the formula for LLM API cost?

monthly cost = actions per month × calls per action
             × ( new input tokens × input price
               + cached input tokens × cached price
               + output tokens × output price ) / 1,000,000

Output tokens include reasoning. Cached tokens are input the provider reuses at a lower price. Everything else is measurement. The free LLM API cost calculator applies this formula to any model’s list price.

How do you build the cost model, step by step?

  1. Name the unit of work. “Draft a support reply”, “summarise a call”, “fix a failing test”. Price that, not “a request”.
  2. Count calls per action. A retrieval answer may be one call. An agent that plans, edits and checks may be ten. Add your retry rate: a timeout that you retry is billed again.
  3. Measure tokens per call on real samples. Take 20 to 50 realistic inputs, not clean demos. For a first rough count before you call any API, paste them into the token counter. Read usage.prompt_tokens, usage.prompt_tokens_details.cached_tokens and usage.completion_tokens from each response. With streaming, set stream_options: {"include_usage": true}; the streaming guide shows where it appears.
  4. Separate new and cached input. The system prompt, tool list and shared documents can be cached if they come first and stay identical. User text cannot.
  5. Include reasoning in output. DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B think before answering. Those reasoning tokens are billed as output, and they are often larger than the visible reply. Why reasoning costs more than you see.
  6. Estimate volume. Active users × actions per user per day × 30.
  7. Multiply and total. Convert token totals to millions and apply the price per 1M.
  8. Price three scenarios. Low, expected and high. Launch traffic is uncertain, and prompts grow over time.
  9. Check limits, not only money. Peak requests per minute and requests in flight must fit your key’s rate limits.
  10. Decide the billing model. Per token for spiky, user-driven traffic; a flat plan for always-on agents.

What does a worked estimate look like? A support reply drafter

A help-desk app adds “Draft reply”. The numbers below are assumptions for illustration. Replace each one with your measurements.

Input Value Where it comes from
Support agents (staff) using the feature 500 Product plan
Drafts per agent per day 4 Pilot usage
Days a month 30
Actions a month 60,000 500 × 4 × 30
Calls per action 1 One call with retrieved articles
Input tokens per call 5,000 System prompt, ticket thread, three help articles
Share of input cached 50% Stable system prompt and article prefix
Output tokens per call 500 About 200 visible, 300 reasoning
Model DeepSeek V4.1 Flash $0.175 / $0.0055 / $0.52 per 1M

Now the totals:

Line Tokens a month Price per 1M
New input 150M $0.175
Cached input 150M $0.0055
Output, including reasoning 30M $0.52
Expected monthly cost $42.67

That is 300M input and 30M output tokens: 60,000 × 5,000 and 60,000 × 500.

How wide should the low and high scenarios be?

Scenario Actions a month Input / output tokens Monthly cost
Low: slow adoption 20,000 100M / 10M $14.23
Expected 60,000 300M / 30M $42.67
High: 3× adoption 180,000 900M / 90M 3 × $42.67

All three keep the same 50% cache share. If the cache share falls, the bill rises: new input costs $0.175 per 1M on this model against $0.0055 cached. How to keep the cache share high.

What moves the estimate the most?

  • Context length. Retrieval that pulls ten articles instead of three can double input. Measure tokens after every prompt change.
  • Reasoning. Setting reasoning_effort to low on simple drafts shrinks hidden output. Reasoning and max_tokens.
  • Retries and loops. A 5% retry rate adds 5% to every line. An agent loop with no step cap has no ceiling at all. Spend control for LLM APIs.
  • Model choice. Gemma 4 VL 26B costs $0.10 input and $0.22 output per 1M, but its context is 32,768 tokens and BroadNet does not list reasoning for it. Test quality before switching to save money.
  • Language. The same content can need far more tokens in Arabic or Hindi than in English, and the gap depends on the tokenizer. Our real cost by language dataset shows the price per 1M characters for each language on each model and provider.
  • Prompt growth. Prompts tend to grow after launch as edge cases get handled. Re-run the measurement each release.
  • Price changes. List prices rarely move, but they can rise. In archived pricing pages from 11 providers, we recorded 52 list-price rises between 2024 and November 2026, each a model’s price compared with its own earlier price (against 100 cuts); the median rise was 40% on a blended price. See how to budget for LLM API price rises.

If the estimate comes out too high, work through the 10-step checklist to reduce LLM API costs before you change the feature.

Does the volume fit the rate limits?

60,000 actions a month is about 2,000 a day. If a tenth of a day’s drafts land in the busiest hour, that is 200 an hour, or about 3 a minute. A BroadNet pay-as-you-go key allows 30 requests a minute and 4 in flight, so this fits one key. Check the high scenario too, or run your own peak through the rate limit calculator. For the math between rate and requests in flight, see concurrency. If you hit 429s, back off and retry.

Should this feature run on a flat plan?

Probably not. A Full Moon session is $60 a month, but a session runs one request at a time, and many users clicking “Draft” at once need parallel requests. Flat plans fit agents that work continuously, such as a coding agent. The break-even math shows a full-time coding agent at $65.40 a month per token, above the plan price.

How do you turn the estimate into a budget?

  1. Put the expected figure in your plan and the high figure in your alert threshold.
  2. Log tokens per action in production and compare with the model every week.
  3. Set hard caps in code: max_tokens, step limits and retry limits.
  4. Re-run the estimate whenever you change the model, the prompt or the retrieval settings.

You can redo the per-token math with your own numbers in the LLM API cost calculator, or check plan against per-token on the pricing page.

Where BroadNet Inference fits

BroadNet Inference publishes per-token prices for every chat and transcription model it serves in one price file, so the estimate above can be kept in code. New accounts get $5 of starting credit, which works on Gemma 4 VL 26B and the two transcription models, so you can measure your samples on Gemma; DeepSeek, GLM and Qwen need a top-up. If your feature needs a closed frontier model, BroadNet is not the right provider for that part.

Questions

How do I estimate the number of tokens before I have users?

Build 20 to 50 realistic inputs, run them through the model you plan to use and read prompt_tokens, cached_tokens and completion_tokens from the usage block. Average them per call.

How many tokens is a typical chat request?

It varies widely. A short chat turn can be a few hundred tokens, while a request with retrieved documents or a long history can be tens of thousands. Measure your own prompts.

Should I add a safety margin to my LLM cost estimate?

Yes. Price a high scenario at two to three times expected volume, and budget for retries and longer prompts as the feature grows. Then set hard limits so a bug cannot exceed it.

When should I consider a flat-rate plan instead?

When one agent or worker runs most of the day on one model. For DeepSeek V4.1 Flash on BroadNet, a Full Moon session costs $60 a month with no token meter, one request at a time.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity