How to Price an AI or LLM SaaS: Cost per Query, Cost per User and Break-Even
Traditional SaaS has near-zero cost per extra user, so pricing is mostly about value and competitors. An AI product is different: every request costs money, heavy users cost far more than light ones, and agent features can multiply token spend in ways a simple calculator misses.
This guide gives you the formulas to get from token prices to a defensible plan price, with a worked example.
All prices in this guide are made-up examples chosen to make the arithmetic easy. They are not any provider's real rates. Always use your provider's current price page, and re-check it regularly — prices change.
Step 1: Cost per query
LLM APIs charge per token, usually quoted per million tokens, with separate prices for input (what you send) and output (what the model writes):
cost per query = input tokens × input price ÷ 1,000,000
+ output tokens × output price ÷ 1,000,000
Example prices (placeholder): $3.00 per 1M input tokens, $15.00 per 1M output tokens.
A typical request in our example product sends 2,000 input tokens (system prompt, a bit of context and the user's question) and gets 500 output tokens back:
| Part | Tokens | Example price per 1M | Cost |
|---|---|---|---|
| Input | 2,000 | $3.00 | $0.0060 |
| Output | 500 | $15.00 | $0.0075 |
| Per query | $0.0135 |
Measure real token counts from your API responses rather than guessing; most APIs return input and output token usage with every call. Include everything you send: system prompt, retrieved documents, tool definitions and conversation history.
Step 2: Cost per user per month
AI cost per user = queries per user per month × cost per query
If an average user sends 300 queries a month: 300 × $0.0135 = $4.05 per user per month.
Don't price on the average user
Usage is rarely even. Suppose your users split like this (example distribution):
| Segment | Share of users | Queries / month | AI cost / user |
|---|---|---|---|
| Light | 70% | 100 | $1.35 |
| Regular | 25% | 500 | $6.75 |
| Heavy | 5% | 2,500 | $33.75 |
| Weighted average | $4.32 |
The average looks comfortable against a $20 plan. The heavy 5% cost $33.75 each — more than they pay. That's why most AI products add fair-use limits, usage-based tiers or credit packs. Decide what happens at the 95th percentile before you launch, not after the invoice.
Step 3: Agent loops grow quadratically
Single calls are easy. Agents are not, because each step re-sends the conversation so far. If the first call carries S tokens and every step adds d tokens of tool results and model output, then step k carries S + d × (k − 1) input tokens, and the total input over n steps is:
total input tokens = n × S + d × n × (n − 1) ÷ 2
Example: S = 1,500 tokens, d = 800 tokens per step, 300 output tokens per step, 10 steps.
| Naive estimate (10 × first call) | Real (context grows) | |
|---|---|---|
| Input tokens | 15,000 | 51,000 |
| Output tokens | 3,000 | 3,000 |
| Cost at example prices | $0.090 | $0.198 |
The real run costs 2.2× the naive estimate. At 20 steps the input total is 182,000 tokens against a naive 30,000 — the gap widens with every step. Add sub-agents and retries and it widens further.
Prompt caching and batch processing can cut these costs on providers that offer them, but the discounts and rules differ. If you haven't verified a discount, model the cost without it.
Step 4: From cost to price
Three numbers matter.
1. Token break-even price — the price that just covers AI cost and payment fees:
break-even price = AI cost per user ÷ (1 − payment fee %)
With $4.05 AI cost and an example 5% payment fee: $4.05 ÷ 0.95 = $4.26. Below that you lose money on every user before paying for anything else.
2. Price for a target gross margin. If you want, say, 80% gross margin after AI cost and fees:
price = AI cost per user ÷ (1 − payment fee % − target margin %)
$4.05 ÷ (1 − 0.05 − 0.80) = $4.05 ÷ 0.15 = $27.00. A $20 plan, by comparison, gives a margin of (20 − 4.05 − 1.00) ÷ 20 ≈ 75%.
3. Break-even number of customers. Fixed costs (hosting, tools, your own salary) need covering too:
contribution per user = price − AI cost per user − payment fees
break-even customers = fixed monthly costs ÷ contribution per user
At $20, contribution is $20 − $4.05 − $1.00 = $14.95. With $1,500 of example fixed costs: 1,500 ÷ 14.95 = 100.3, so 101 paying customers.
Step 5: Price the free tier
Free users aren't free. Treat their AI cost as a fixed cost:
free tier cost = free users × free queries per user × cost per query
2,000 free users × 30 queries × $0.0135 = $810 per month. Break-even becomes (1,500 + 810) ÷ 14.95 = 154.5, so 155 paying customers instead of 101. A free tier is often worth it — but make it a decision with a number attached.
Worked example summary
| Item | Example value |
|---|---|
| Cost per query | $0.0135 |
| AI cost per average user | $4.05 / month |
| Heavy user (95th-percentile-style) | $33.75 / month |
| Token break-even price | $4.26 |
| Price for 80% gross margin | $27.00 |
| Break-even customers at $20 | 101 |
| …with a 2,000-user free tier | 155 |
A pricing checklist
- Log real token counts for each feature, not one blended guess.
- Model agent features with context growth, retries and sub-agents.
- Look at heavy users, not just the average.
- Set limits or usage tiers for the top 5%.
- Cost the free tier.
- Recalculate whenever model prices or usage change.
Spreadsheet setup
In a sheet, put input tokens in B1, output tokens in B2, input price per 1M in B3, output price per 1M in B4, queries per user in B5 and plan price in B6:
Cost per query: =B1*B3/1000000+B2*B4/1000000
Cost per user: =B5*(B1*B3/1000000+B2*B4/1000000)
Gross margin %: =(B6-B5*(B1*B3/1000000+B2*B4/1000000))/B6
Tools
For a quick first number, the free AI API Cost Calculator Lite turns model prices, tokens and usage into cost per query, cost per user and a simple gross margin, with a comparison across six starter models and dated, cited list prices. It deliberately doesn't model caching, batch discounts or overhead.
For the full picture, the AI Cost & Margin Model has nine tabs: an editable Model Prices table, per-feature costs, unit economics and break-even per plan (including the free tier), an Agent Loops tab that models context growth, sub-agent fan-out, retries and caching next to the naive estimate, model comparison, a 12-month scale and runway view, and a Reality Check tab that flags plans that don't work.
Frequently asked questions
How do I calculate the cost per query of an LLM API?
Multiply input tokens by the input price and output tokens by the output price, each divided by one million if prices are quoted per million tokens, then add the two.
What gross margin should an AI SaaS target?
There's no fixed rule. Calculate the price needed for the margin you want with price = AI cost ÷ (1 − fee % − target margin %), then compare it with what customers will pay.
Why do AI agents cost more than expected?
Each step of an agent loop re-sends the conversation so far, so input tokens grow roughly with the square of the number of steps. A naive estimate that multiplies one call by the step count undercounts.
Should I offer a free tier for an AI product?
Only with a number attached. Multiply free users by their queries and your cost per query, add it to fixed costs, and see how many more paying customers you need to break even.
Are the prices in this guide real?
No. They are placeholders chosen for easy arithmetic. Use your provider's current price page.