Builders Camp

Other Guides

How to Estimate LLM API Costs for a Product Feature

Estimate an LLM feature's monthly cost as requests per month x (input tokens x input price + output tokens x output price), then add retries and subtract caching, routing and batch savings. In the worked example below, 10,000 active users sending 20 requests each cost $2,100 a month on Claude Sonnet 5.5 before optimisation and $454.45 after caching and routing 70 percent of traffic to Claude Haiku 5.5. Use the vendor's own pricing page, and redo the sum whenever a price or a prompt changes.

Every LLM API bill comes down to three numbers per request: input tokens, output tokens, and the price of each. As of October 2026, Anthropic's pricing documentation lists Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens, and OpenAI's pricing documentation lists gpt-6.1-sol at the same $2.00 and $10.00. Discounts can halve it. Anthropic's pricing page says: "The Batch API allows asynchronous processing of large volumes of requests with a 50% discount on both input and output tokens."

On every model priced on this page, an output token costs five times or more what an input token costs, so the length of what the model writes matters more than the length of what you send it. The rest of the estimate is counting carefully.

What is the formula for an LLM feature's monthly cost?

Monthly model cost equals requests per month multiplied by the cost of one request, where one request costs (input tokens x input price) plus (output tokens x output price), with prices quoted per million tokens. Every adjustment below changes one term of that formula.

  • Requests per month = active users of the feature x requests per user per month x (1 + retry rate).
  • Input tokens = system prompt + instructions + retrieved context + the user's own message. Tool definitions count too: Anthropic's pricing page lists a tool use system prompt of 286 tokens on Claude Sonnet 5.5 and says "These token counts are added to your normal input and output tokens to calculate the total cost of a request."
  • Output tokens = the visible answer plus any reasoning tokens. Google's Gemini pricing page labels its output column "Output price (including thinking tokens)", so a model that thinks before it answers bills that thinking as output.

If you need a refresher on what a token is and why a model reads your whole prompt every call, the large language model and context window entries cover both.

What does a worked estimate look like?

Take a B2B product adding an AI summary to each project page. The usage numbers are illustrative assumptions for this guide, not data from any real product: 10,000 monthly active users of the feature, 20 summaries per user per month, a 5 percent retry rate for responses that fail your output validation, 3,000 input tokens per request (a 2,000-token shared system prompt and instructions, plus 1,000 tokens of project data) and 400 output tokens. Prices are Claude Sonnet 5.5 as listed on Anthropic's pricing page as of October 2026.

Step Working Result
Requests per month 10,000 users x 20 requests 200,000
Add 5% retries 200,000 x 1.05 210,000
Input cost per request 3,000 tokens x $2 / 1,000,000 $0.006
Output cost per request 400 tokens x $10 / 1,000,000 $0.004
Cost per request $0.006 + $0.004 $0.010
Monthly cost 210,000 x $0.010 $2,100.00
Cost per active user $2,100 / 10,000 $0.21

Notice the output line. 400 output tokens cost two thirds as much as 3,000 input tokens, because each output token is priced at five times an input token on this model. Capping answer length is often the cheapest optimisation you have.

How much do caching, routing and batch change the estimate?

Prompt caching, model routing and batch processing each attack a different term, and on the example above they cut the bill by up to 78 percent. Each one comes with an assumption you have to defend.

Caching discounts the repeated prefix. Anthropic lists a cache hit on Claude Sonnet 5.5 at $0.10 per million tokens and a 5-minute cache write at $2.50 per million, against $2 for normal input. Assume 95 percent of requests read the 2,000-token prefix from cache and 5 percent write it again after the cache expires:

  • Uncached input: 1,000 x $2 / 1,000,000 = $0.002
  • Cache reads: 0.95 x 2,000 x $0.10 / 1,000,000 = $0.00019
  • Cache writes: 0.05 x 2,000 x $2.50 / 1,000,000 = $0.00025
  • Input per request: $0.002 + $0.00019 + $0.00025 = $0.00244, plus $0.004 output = $0.00644
  • Monthly: 210,000 x $0.00644 = $1,352.40

Routing sends easy requests to a smaller model. Claude Haiku 5.5 is listed at $0.10 input, $0.50 output, $0.01 cache hit and $0.125 for a 5-minute cache write, per million tokens, for prompts up to 100,000 tokens. With the same caching assumption, a Haiku request costs $0.0001 + $0.000019 + $0.0000125 + $0.0002 = $0.0003315. Route 70 percent of traffic there and keep 30 percent on Sonnet:

  • Blended request: 0.7 x $0.0003315 + 0.3 x $0.00644 = $0.00023205 + $0.001932 = $0.00216405
  • Monthly: 210,000 x $0.00216405 = $454.45, or about $0.045 per active user

Batch halves the price for work nobody waits on. At Anthropic's batch rates for Claude Sonnet 5.5 ($1 input, $5 output per million tokens), the uncached request costs 3,000 x $1 / 1,000,000 + 400 x $5 / 1,000,000 = $0.005, so 210,000 requests cost $1,050. Anthropic's page says its caching multipliers "stack with other pricing modifiers, including the Batch API discount", but a summary a user is staring at cannot wait for a batch job, so batch only fits the asynchronous parts of a feature.

Scenario (Claude models, as of October 2026) Cost per request Monthly cost Per active user
Sonnet 5.5, no caching $0.010 $2,100.00 $0.21
Sonnet 5.5, batch, no caching $0.005 $1,050.00 $0.105
Sonnet 5.5, prefix cached $0.00644 $1,352.40 $0.135
70% Haiku 5.5 / 30% Sonnet 5.5, cached $0.00216405 $454.45 $0.045

The 95 percent hit rate is the weakest number in the table. A cache only helps when the same prefix comes back before it expires; 210,000 requests a month is roughly five a minute on average, which keeps a 5-minute cache warm at busy hours and lets it go cold overnight. The 70 percent routing share is the second weakest: it holds only if you have tested that Haiku's summaries pass the same quality bar on those requests.

How do the three big vendors compare on the same workload?

Run the same workload (210,000 requests, 3,000 input and 400 output tokens, no caching) through each vendor's listed standard price and the mid-tier models land close together while the cheapest rows in this table differ by almost four times ($105 against $399). Prices are per million tokens as of October 2026, taken from the Anthropic, OpenAI and Google Gemini API pricing pages, with OpenAI's short context rate (272K input tokens or fewer) and Gemini 3.1 Pro Preview's rate for prompts of 200k tokens or fewer.

Model (vendor's name) Input / output per 1M tokens Cost per request Monthly cost
Claude Sonnet 5.5 $2 / $10 $0.0100 $2,100.00
gpt-6.1-sol $2.00 / $10.00 $0.0100 $2,100.00
Gemini 3.1 Pro Preview $2.00 / $12.00 $0.0108 $2,268.00
Gemini 3.8 Flash (through December 31, 2026) $0.75 / $3.75 $0.00375 $787.50
Gemini 3.8 Flash (from January 1, 2027) $1.50 / $7.50 $0.0075 $1,575.00
Gemini 3.5 Flash-Lite $0.30 / $2.50 $0.0019 $399.00
Claude Haiku 5.5 $0.10 / $0.50 $0.0005 $105.00
gpt-6-luna $0.10 / $0.50 $0.0005 $105.00

Two warnings before you pick the cheapest row. First, the token counts are not portable: Anthropic's page says its newer tokenizer "produces approximately 30% more tokens for the same text" than its previous one, and other vendors tokenize differently again, so measure your real prompt on each model. Second, prices move: Google's page already shows Gemini 3.8 Flash doubling on January 1, 2027, so a budget built on the 2026 row is out of date in under three months. Gemini context caching also carries a storage charge, listed at $4.50 per million tokens per hour on Gemini 3.1 Pro Preview, so add it to any Gemini caching estimate.

How is estimating cost different from pricing an AI feature?

Cost is what you pay the model vendor to serve a user; price is what that user pays you. The guide to pricing an AI agent covers the second question (per seat, per action, per workflow or per outcome), and its first check is the number this page produces: your cost to serve a heavy user, which it says to model for your top 10 percent of users rather than the average.

Keep the two numbers in separate lines of your unit economics. Model spend is a cost of serving an existing customer, so it reduces gross margin. It is not part of customer acquisition cost, which counts what you spend to win that customer. As an illustration only, if the feature sits in a plan at $20 per user per month, $0.21 of model cost is about 1 percent of revenue, and the routed $0.045 is about 0.2 percent.

Where does a token estimate usually go wrong?

Average usage hides the users who cost you money. A user who opens 100 summaries a month instead of 20 costs 100 x 1.05 x $0.010 = $1.05 on uncached Sonnet 5.5, five times the average, and an agent feature that loops through tools can spread much wider than that. Estimate from a distribution, at minimum the median and the 90th percentile user, not from a single average.

Prompts also grow after launch. Every new instruction, retrieved document and tool definition is added to every request, and nobody files a ticket for it. Log real input and output token counts per request from the first day of a beta, then replace each assumption in your model with the measured number. The assumptions that move the total most (output length, cache hit rate, routing share) are the ones to measure first.

What should you put in front of finance?

A one-page estimate with the formula, every assumption labelled as an assumption, the vendor and model name with the date you read the price, and three scenarios: expected, heavy usage, and the price after any announced change. Add the payback period if the feature carries build cost, and say which single assumption would change the decision if it turned out wrong.

Builders Camp's Business for Product Managers bootcamp covers revenue, costs, unit economics and P&L thinking in one week, led by its own programme director, and its practical challenge asks you to audit the business case for an AI feature against a CFO's 24-month payback rule, the same kind of document this estimate feeds.

Bootcamps referred in this Guide

Frequently asked questions

What is the formula for estimating LLM API cost?

Monthly cost = requests per month x (input tokens per request x input price + output tokens per request x output price), with prices per million tokens divided by 1,000,000. Multiply the request count by your retry rate first, then adjust the input term for cached tokens and the whole term for any model routing or batch discount.

Why are output tokens priced higher than input tokens?

Vendors set them that way, so your estimate has to treat them separately. As of October 2026, Anthropic lists Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens, and OpenAI lists gpt-6.1-sol at $2.00 and $10.00. A feature that writes long answers is far more sensitive to output length than to prompt length.

Does the same prompt cost the same number of tokens on every model?

No. Each vendor counts tokens with its own tokenizer. Anthropic's pricing page says its newer tokenizer, used by Claude 4.7 and later models, produces approximately 30% more tokens for the same text than the previous one. Count your real prompts with each vendor's own token counter before you compare prices.

How much does prompt caching save?

It depends on how much of each prompt is a repeated prefix and how often the cache is hit. In the worked example on this page, caching a 2,000-token shared prefix on Claude Sonnet 5.5 cuts the monthly bill from $2,100 to $1,352.40, a saving of about 36 percent, assuming 95 percent of requests hit the cache.

When should I use a batch API?

Use it for work the user does not wait for: overnight digests, backfills, bulk classification. Anthropic's Batch API is priced at a 50% discount on both input and output tokens, OpenAI publishes a separate batch price table, and Google lists Batch API (50% cost reduction) on its paid tier.

Is the cost of serving an LLM feature part of customer acquisition cost?

No. Model spend is a cost of serving an existing user, so it belongs in gross margin and unit economics, not in customer acquisition cost, which counts what you spend to win the customer in the first place. Mixing the two hides an AI feature's real margin.

How often should I redo the estimate?

Every time a vendor changes its price list, you change models, or your prompt grows. Google's pricing page already shows Gemini 3.8 Flash input rising from $0.75 to $1.50 per million tokens on January 1, 2027, which doubles that line of the estimate overnight.

Sources

Written by

Guilherme Salgueiro

Guilherme Salgueiro

Builder and AI systems practitioner. Guilherme helps developers, PMs, and founders move beyond prompting into structured AI system design -- building with Claude Code, agents, and automation pipelines to ship products faster and more reliably.

Builder and AI systems practitioner. Guilherme helps developers, PMs, and founders move beyond prompting into structured AI system design — building with Claude Code, agents, and automation pipelines to ship products faster and more reliably.

LinkedInMore guides by Guilherme Salgueiro

Last updated 2026-10-12

Researched from Builders Camp's bootcamp, track and masterclass material and the sources listed on this page, drafted with AI, and fact-checked against every source cited.

See the Business for Product Managers bootcamp