How to estimate the AI cost of a SaaS feature
An AI assistant can turn a high-margin subscription into a low-margin one, because every request has a cost. This guide works from a single request to the cost per customer, shows the effect on gross margin and payback, and covers the levers that keep the feature profitable.
AI features have a cost per use
Most software costs little to serve once it is built: another customer adds a few cents of hosting. Features built on a large language model (LLM) are different. Every request is billed by the model provider, so the cost grows with how much each customer uses the feature. A plan that was 90% gross margin can drop well below that once an AI assistant is added, and a few heavy users can cost more than they pay.
The way to plan for this is to work out the AI cost per active customer per month and treat it as part of your cost of service, alongside hosting, support and payment fees.
AI cost per customer per month = Requests per customer per day × Cost per request × 30.4
Cost per request = Input tokens × Input price + Output tokens × Output price (prices per token)
Step 1: measure a typical request
Start with what a single request sends and receives. The input is everything in the prompt: system instructions, any retrieved documents or chat history, and the user's message. The output is the model's reply. In a prototype, log the token counts the API returns with each response; they are more reliable than estimates from word counts.
For this guide, take an assistant inside a $20-a-month product. A typical request sends 3,000 input tokens (a long system prompt plus context) and returns 600 output tokens. At example prices of $3 and $15 per million tokens for a large model, one request costs $0.0180.
Step 2: estimate usage per customer
Next, estimate how often an active customer uses the feature. Usage is rarely even: most customers use it a little, and a small group uses it constantly. Plan with the average across all paying customers, then check the heavy users separately.
If the average customer makes 10 requests a day, the AI cost is about $5.48 per customer per month, more than a quarter of the price. The LLM API cost calculator does this arithmetic for any usage and prices.
Step 3: see what it does to gross margin and payback
Suppose the product already costs $2 per customer per month to serve, customers cost $120 to acquire, and 3% cancel each month. The table compares the plan without the feature, with it, and with two common optimizations.
| Scenario | AI cost per customer | Gross margin | CAC payback |
|---|---|---|---|
| No AI feature | $0.00 | 90.0% | 8 months |
| AI feature, large model, no optimization | $5.48 | 62.6% | 12 months |
| With prompt caching (70% of input) | $3.75 | 71.2% | 10 months |
| Caching, and 60% of requests on a smaller model | $2.10 | 79.5% | 9 months |
Without optimization the AI feature cuts the gross margin from 90.0% to 62.6%, and the months needed to earn back acquisition cost rise from 8 to 12. Payback is worked out the way the CAC payback calculator does it, allowing for customers who cancel along the way.
Step 4: lower the cost per request
- Prompt caching. When the same long instructions or documents are sent with every request, providers can cache them and charge a fraction of the input price for the cached part. In the example, caching 70% of the input brings the cost to $3.75 per customer.
- Route simple requests to a smaller model. Classification, short answers and formatting rarely need the most capable model. Sending 60% of requests to a model priced at an example $0.80 and $4 per million lowers the cost to about $2.10.
- Shorten the output. Output tokens usually cost several times more than input. Asking for concise answers and setting a maximum length is often the single biggest saving.
- Trim the context. Retrieve only the most relevant passages instead of whole documents, and summarize long chat histories rather than resending them in full.
- Batch work that can wait. Reports and background processing can often use a discounted batch API.
Step 5: protect the plan from heavy users
An average is not enough on a flat-price plan. A customer making 50 requests a day in the unoptimized example costs $27.38 a month, more than the $20 they pay. Common ways to handle this:
- A fair-use limit per month on the base plan, with a clear message when it is reached.
- Higher tiers or add-on credit packs for customers who need more.
- Usage-based pricing for the AI feature alone, so the price follows the cost.
- Monitoring cost per customer each month, so a change in behavior shows up before the invoice does.
Whatever the model, set the price from the cost, not the other way round. Decide the gross margin you need, add the AI cost to the cost of service, and work out the price with the markup and margin calculator. Provider prices change often, usually downwards, so recheck the numbers whenever you switch models or a new price list is published.