AI unit economics is the practice of measuring what it costs to deliver a useful AI outcome, then comparing that cost with the revenue the outcome supports. To protect SaaS margins, model costs per completed workflow, include every part of serving that workflow, and set technical and pricing controls before usage grows. Start by linking model usage to product events, not by dividing the API invoice by the number of customers.
That gives finance and engineering a shared basis for decisions: what to automate, what to charge for, which model to use, and when to stop an unproductive run. If you are still choosing where AI belongs in the product, our AI strategy and solutioning service can help establish the use cases and business measures before you build.
What are AI unit economics, and why do they matter to SaaS?
A unit is the smallest business outcome that matters to your product. It might be one support ticket resolved, one document reviewed, one invoice processed, or one customer month of AI-enabled service. AI unit economics measures the revenue and direct cost associated with that unit.
This is different from looking at the provider invoice alone. A $10,000 monthly model bill could be healthy if it helps deliver $100,000 of profitable customer value. A $1,000 bill could be unhealthy if it supports a small number of low-priced accounts or hides costly retries, retrieval, and human review.
Traditional software has costs too, including hosting, support, payment processing, and customer success. But AI changes the marginal cost profile. A conventional feature may require little additional compute when one more customer uses it. An AI feature may incur a new inference charge every time a customer asks a question, generates a draft, or runs an agent. Inference is the calculation a model performs to produce a response. When that work directly serves customers, its cost generally belongs in cost of goods sold, or COGS, the direct cost of delivering what you sell.
That makes gross margin a product design concern, not just a finance metric. Gross margin is revenue less direct delivery costs, expressed as a share of revenue. If a product earns $100 and spends $25 directly serving it, its gross margin is $75, or 75 per cent. The exact accounting treatment depends on your organisation's policies and circumstances, so agree the classification with your finance team. The useful operating principle is to separate customer-serving inference from internal research, development, and testing rather than blending it all into one cloud line.
AI product margins vary by business model, workload, pricing, and stage. Bessemer Venture Partners describes AI-first companies facing a different cost structure from traditional SaaS and discusses the pressure compute can place on margins in its analysis of AI supernovas. Treat industry comparisons as context, not as a target for your own product. The important figure is your margin by customer, workflow, and usage cohort.
A useful starting measure is contribution per outcome:
Contribution per outcome = revenue attributable to the outcome minus fully loaded cost to serve it.
For a subscription, revenue may not map neatly to individual outcomes. In that case, estimate how much of the subscription supports the AI function, or compare AI delivery cost with total subscription revenue by account and month. You need a measure that lets you see whether a change in usage, model choice, or product packaging improves or weakens the economics.
How do you calculate the cost of serving an AI workflow?
First, define the workflow boundary. A customer request that starts when a user submits a prompt and ends when a useful result is delivered is often a reasonable unit. For an agent, the boundary should include tool calls, retries, and final checks. Do not count only the first model response if the system continues working behind the scenes.
Next, calculate the full direct cost of that unit. A practical formula is:
Cost to serve = model input and output + retrieval and embeddings + tools and middleware + reranking and evaluation + other variable delivery costs.
A token is a small unit of text processed by a language model. Input tokens include instructions, customer content, retrieved material, and conversation history. Output tokens are the generated response. Providers bill these categories separately, and output can have a higher unit price. Check your current provider rate card rather than relying on a remembered price or a rate quoted in an old article.
Retrieval means finding relevant information, often from a customer knowledge base, and adding it to a model request. Embeddings are numerical representations of text used to search for similar content. A vector database stores and searches those representations. Reranking is a second step that reorders candidate results by relevance. These components can carry their own infrastructure or API charges, even when the final model call is inexpensive.
Middleware is the software between your product and the model. It may handle authentication, retries, logging, routing, policy checks, or formatting. Tool execution is the work an agent requests from another system, such as searching a database or creating a support ticket. Some tool calls are effectively free at small scale; others invoke paid services or consume significant compute. Include them when they vary with customer usage.
Then allocate the costs to a product event. A clean event record might capture:
- Tenant and account identifier, using a safe internal identifier rather than sensitive personal information.
- Workflow name and outcome status, such as completed, failed, or sent for human review.
- Model and model version used at each step.
- Input and output token counts for each call.
- Cache status, where available, and the amount of input served from cache.
- Retrieval, tool, and middleware activity.
- Retry count, total duration, and any human handling required.
- The estimated direct cost calculated from the applicable rate card.
Keep raw token counts and dollar costs as separate fields. Rate cards change, and a clean usage record lets you recalculate historic usage under new rates or compare provider options. Store the rate-card version used for each calculation. Also record the customer outcome. A cheap run that fails to resolve the task is not necessarily better than a more expensive run that succeeds.
Consider an illustrative support-ticket workflow. Assume a product sends 12,000 input tokens and 1,000 output tokens to a model. For simple arithmetic, suppose the internal planning rate is $3 per million input tokens and $15 per million output tokens. These are example assumptions, not a current quote for any model. The model charge is 12,000 divided by 1,000,000 multiplied by $3, plus 1,000 divided by 1,000,000 multiplied by $15. That equals 3.6 cents plus 1.5 cents, or 5.1 cents per call.
Now suppose the workflow makes two model calls, incurs 2 cents of retrieval and tool cost, and uses 1 cent of other variable delivery services. The illustrative direct cost is 13.2 cents per run. If only 80 per cent of runs produce a completed resolution, the expected cost per completed resolution is not 13.2 cents. It is 13.2 cents divided by 0.8, or 16.5 cents, assuming failed attempts have the same cost and do not later succeed through a separate path.
That last adjustment matters. A workflow that fails often can look cheap when measured per attempt and expensive when measured per useful result. You should also measure the share sent for human review and the associated handling cost. If staff time is a direct part of delivering the promised service, excluding it will overstate the margin improvement from automation.
For a fuller view, calculate these measures separately:
| Measure | What it tells you | How to calculate it |
|---|---|---|
| Cost per attempt | Cost of one run, including failed runs | Direct variable cost divided by attempts |
| Cost per completion | Cost of delivering the outcome | Direct variable cost divided by completed outcomes |
| Cost per account-month | AI delivery burden by customer | Direct AI costs for an account in a month |
| Gross margin by account | Whether account revenue covers direct service costs | Revenue less direct costs, divided by revenue |
| Success rate | How often the workflow reaches its defined outcome | Completed outcomes divided by eligible attempts |
| Human escalation rate | How often the process needs staff intervention | Escalated runs divided by eligible attempts |
CloudZero's overview of AI gross margin also makes the case for connecting AI spend to product and customer economics rather than treating cloud and model bills as isolated totals. The practical move is to build a reliable link from usage event to workflow to account to revenue.
How should you model token use and power-user costs?
Do not model a typical customer by taking the average across all accounts and assuming usage is evenly distributed. Product usage is often uneven. A small number of accounts may submit long documents, run repeated analyses, or automate activity at a high rate. Your own data should show whether that pattern exists and how concentrated the cost is.
Model at least three usage profiles: light, expected, and heavy. These are planning cases, not claims about a universal distribution. Define each one using real product behaviour where available. A profile could describe the number of workflows per month, average input and output tokens, average tool calls per workflow, retry rate, and percentage of results escalated to people.
A spreadsheet can make the model concrete:
| Input to the model | Light-use case | Expected-use case | Heavy-use case |
|---|---|---|---|
| Workflows per account per month | Your measured or assumed value | Your measured or assumed value | Your measured or assumed value |
| Average input tokens per workflow | Measure or assumption | Measure or assumption | Measure or assumption |
| Average output tokens per workflow | Measure or assumption | Measure or assumption | Measure or assumption |
| Model calls per workflow | Include retries and agent steps | Include retries and agent steps | Include retries and agent steps |
| Retrieval and tool cost per workflow | Estimate from usage | Estimate from usage | Estimate from usage |
| Completion rate | Measure in production | Measure in production | Measure in production |
| Monthly AI cost per account | Formula result | Formula result | Formula result |
Use observed percentiles as well as averages when you have enough data. The median describes the middle account. A high percentile shows the cost of heavier users. The exact percentile to monitor depends on your product, but the aim is to see the tail rather than let it disappear inside a blended average. Break results down by workflow, plan, account size, model, and feature where the event data supports it.
In a fixed per-seat product, compare cost per seat with subscription revenue per seat. Then examine cost at the account level. A few high-usage users can be affordable within a large account but damaging in a small one. Conversely, account-wide averages can hide a single integration or automated process generating most of the usage.
A basic monthly account model is:
AI cost per account = number of workflow attempts × average direct cost per attempt.
A more useful version separates the parts:
AI cost per account = attempts × [input cost + output cost + retrieval and tool cost + other variable cost].
For token costs, calculate input tokens and output tokens independently. If the workflow uses multiple models, calculate each call against the correct model rate. Include retries and background jobs. Do not assume the model used in development is the same one used in production, or that all requests route to one provider.
The result is a set of decision cases. If the heavy-use account would have negative contribution under current packaging, you can test a quota, a different model route, a higher tier, an overage charge, or a workflow limit. The point is not to punish a customer for useful adoption. It is to make a commercial promise that remains sustainable under plausible usage.
Monetizely's analysis of AI-first SaaS economics discusses the relationship between AI delivery costs and SaaS pricing. Use such commentary to inform questions, not as a substitute for your own invoices, usage data, and customer willingness to pay.
When does context caching reduce cost?
Context caching stores or reuses a repeated part of a model request so the provider can avoid processing the same prefix in the normal way on every call. A prefix is the beginning section of a request, which might contain stable system instructions, tool definitions, or reference material. Caching is most useful when the same substantial prefix appears repeatedly within the provider's cache window.
A cache hit is a request where the provider recognises and reuses eligible cached context. A cache miss means the request does not qualify, so the normal input pricing applies. Provider rules differ. They can vary by model, minimum context size, cache duration, and whether the cache is automatic or explicitly controlled. OpenAI describes its prompt caching behaviour and pricing considerations, while Google documents context caching for Gemini on Vertex AI. Check the live documentation for the model and API you actually use.
Caching is an economic trade-off. Some providers charge a premium to create or write a cache, then charge less for later reads. Others apply different rules. Do not assume that a cache hit is free, or that one cached call guarantees an overall saving. Calculate the total cost across the expected number of reuses before the cache expires.
Here is an illustrative calculation, not a universal provider tariff. Let one un-cached request prefix cost 1.00 cost unit. Assume a cache write costs 1.25 units, and a cache read costs 0.10 units. Without caching, two requests cost 2.00 units. With caching, one write and one read cost 1.35 units, so the two requests save 0.65 units, or 32.5 per cent. With only one request, the write costs 1.25 units instead of 1.00, so caching is more expensive. Your actual break-even point depends on the provider's prices, cache duration, and hit rate.
A practical model is:
Expected cached input cost = write cost + expected cache reads × read cost + misses × uncached cost.
Compare that with the cost of sending the full prefix uncached for every request. Use measured cache-hit rates, not an assumed perfect hit rate. If a request only partly matches the cached prefix, or the cache expires before reuse, the savings may be smaller than the theoretical case.
Prompt layout affects the chance of a hit. Keep stable material together at the beginning of the request where the provider expects it. Put variable content, such as the latest user message or request-specific details, after the stable material. A timestamp or changing identifier placed near the start can make an otherwise reusable prefix different from one request to the next. Confirm the exact matching rules in the API documentation, because they are provider-specific.
Time between calls matters too. A person may pause between conversation turns longer than a cache remains available. If your workload has long idle gaps, test whether a longer-lived cache is worth its price, or whether rebuilding the context is cheaper. The right choice depends on actual user behaviour. Measure cache write costs, cache reads, misses, and the volume of reusable input by workflow.
Finally, caching does not replace context management. A long conversation can carry irrelevant history forward. Remove material that no longer helps the current task, keep reference content relevant, and test whether shorter context preserves answer quality. Reducing unnecessary input can save money even when caching works well.
Why do agent loops create unpredictable bills?
An agent is a system that uses a model to decide what to do, may call tools, observes the result, and then decides whether another step is needed. An agent loop is the repeated cycle of model call, tool action, and model response. This can handle multi-step work, but each step can add model, tool, and orchestration cost.
For example, an agent might read a request, search records, inspect results, call a second service, draft a response, and check the draft. That is several model calls, not one. Some frameworks also pass previous messages, tool descriptions, and observations back into later calls. The input grows as the run progresses unless the system controls the context. A model call that seems inexpensive in isolation can become material when repeated many times.
Build the cost model around a complete task, not around a single inference. Record calls per run, tokens per call, tools invoked, retries, wall-clock time, and final status. Then calculate the distribution of cost per completed task. Separate normal runs from unusual runs, but do not discard the unusual runs from your financial risk analysis. A rare runaway job may be a serious product and customer issue even if it barely changes the average.
Common failure patterns include:
- Retry loops: A tool rejects an input, the agent changes it slightly, and it tries again without resolving the underlying error.
- Agent ping-pong: Two agents repeatedly critique each other's work without a clear stop condition.
- Unproductive polling: A scheduled agent repeatedly checks for work even when nothing is waiting.
- Context growth: Each step carries an expanding history, including irrelevant tool output and prior reasoning.
- Partial failure: The system performs paid work but does not return a result the customer can use.
The strongest cost controls sit outside the model. A circuit breaker is a deterministic rule that stops execution when a defined limit is reached. Set limits for maximum model calls, tool iterations, elapsed time, and spend per run. The limits should match the workflow's business value and the customer promise. If an agent hits a ceiling, stop safely, record why, and send the task to a fallback path such as a human review queue.
Do not ask an agent to decide whether it has spent too much. It cannot be the only control over its own budget. Enforce the budget in your orchestrator or gateway, the software layer that sends requests to model providers. Keep per-run and per-tenant limits, and alert on abnormal usage. Ensure the stop condition still applies when a tool fails or a worker restarts.
A simple retry detector can also help. Record the tool name and a normalised version of its arguments. If the same call repeats without a meaningful change, stop the loop or require human approval. More advanced monitoring can look for repeated sequences of calls, rapid growth in token use, or a task that is taking much longer than its normal profile.
Route work to the least expensive model that meets the quality bar. A smaller model may be suitable for classification, extraction, or checking structured inputs. A more capable model may be justified for ambiguous synthesis or higher-risk decisions. Test both quality and cost on representative examples before changing the route. Model tiering only improves unit economics if the cheaper route still achieves an acceptable completion rate and does not create extra retries or human work.
If you are moving agents from prototype to production, PADISO's AI agents and automation service covers workflow design, tool use, evaluation, and operational controls. The unit to assess is the complete, bounded run that delivers the result, including its failure path.
How should SaaS companies price AI features?
Pricing should reflect what customers value and what your product can afford to deliver. It does not have to expose tokens. Most buyers care about a business outcome, such as an invoice processed or a support request resolved, rather than the number of model tokens behind it.
There are several workable packaging patterns:
| Pricing approach | How it works | Advantages | Risks to manage |
|---|---|---|---|
| Included usage | AI use is included in a fixed subscription | Simple to understand and sell | Heavy users can outspend the subscription revenue |
| Seat plus allowance | Subscription includes a defined quantity of AI activity | Predictable baseline with clear boundaries | Allowance must map to meaningful usage and customer value |
| Credits or prepaid usage | Customers buy a balance consumed by eligible workflows | Makes variable use visible and supports top-ups | Credits can confuse buyers if conversion to outcomes is unclear |
| Metered overage | Usage above an included amount is charged separately | Aligns exceptional usage with delivery cost | Surprise bills can damage trust if warnings are poor |
| Outcome-based fee | Charge per completed result or business event | Ties price to value rather than technical consumption | Outcome definitions and quality disputes need careful design |
A hybrid is often a practical starting point: charge a subscription for the core software, include a reasonable amount of AI activity, then provide clear usage visibility and a fair response when an account exceeds its allowance. That response could be a customer-approved top-up, a tier change, a slower processing queue, or a pause on additional runs. Avoid silently degrading quality or allowing a background process to consume a customer's budget without notice.
Use customer research and actual costs to set the allowance. First define which events count, then estimate costs for light, expected, and heavy use. Choose a guardrail that is understandable in product terms. For example, a product might count completed document reviews rather than tokens, while an internal cost model still tracks the tokens and tool calls for each review.
Before changing price, check whether the cost problem comes from the product design. A long prompt, unnecessary model call, poor retrieval, or repeated retry may be fixable without changing the customer offer. Conversely, if a workflow delivers clear value and has a high variable cost, pricing that value fairly may be better than hiding all use inside a flat seat fee.
Set usage protections at more than one level. A per-user limit can prevent a single account from generating a burst of activity. A per-tenant budget protects the whole customer account. A global budget or provider-level alert can protect the business from an unexpected integration or software defect. Make limits configurable, visible, and auditable so that support teams can explain what happened.
There is no universal gross-margin target that makes a product healthy. A new feature may have a different margin profile from the core product, and strategic investment may be intentional. The key is that management knows the trade-off, the exposure is bounded, and there is a credible path to sustainable delivery economics. Bessemer's discussion of AI company economics is useful context, but your pricing decision should come from your product's costs and customer value, not a borrowed benchmark.
What should finance and product teams review each month?
A monthly review should join financial measures with product performance. A low-cost model that produces weak results is not an improvement. A useful dashboard should show how economics move when you change a prompt, model, cache strategy, pricing tier, or workflow.
Review these measures together:
- AI cost as a share of revenue, by product and customer segment.
- Cost per attempt and cost per completed outcome.
- Gross margin by account and usage cohort.
- Input and output tokens, model calls, and tool calls per completed workflow.
- Cache hit rate, write cost, and estimated savings against an uncached baseline.
- Completion rate, retry rate, and human escalation rate.
- Share of total cost from the highest-usage accounts and workflows.
- Spend per run and number of runs stopped by a circuit breaker.
- Quality results from evaluations and customer feedback.
An evaluation is a repeatable test of whether a model or workflow meets a defined quality standard. Keep a representative set of examples and compare quality when you reduce context, change models, or add routing. If a cost optimisation reduces successful completion or raises staff review time, calculate the full effect rather than celebrating the lower API bill.
Set owners for the measures. Finance can own revenue and margin definitions. Engineering can own event instrumentation, rate-card calculations, and technical limits. Product can own workflow outcomes and packaging. Support or operations can report escalation effort. One person should be accountable for resolving gaps between the figures, especially when provider invoices do not reconcile with internal usage records.
A monthly review is not enough for runaway risks. Real-time or near-real-time alerts should flag spend spikes, unusual call rates, and limit breaches. The review meeting is for trend analysis and decisions; automated controls are for stopping a problem before it grows.
A practical 30-day plan to build your first model
You do not need a perfect cost model to begin. You need a consistent definition of the unit, reliable usage events, and a plan to improve accuracy.
Week one: choose the unit and baseline. Pick one customer-facing workflow with meaningful AI usage. Write down its start and end points, what counts as success, what counts as failure, and what requires human review. Agree with finance how to treat customer-serving model and retrieval costs.
Week two: instrument the workflow. Add usage records for model calls, tokens, model selection, cache status, tools, retries, and outcome. Attach records to a safe account identifier and a workflow run identifier. Test that failed runs and background jobs are visible, not just successful user-facing responses.
Week three: calculate and inspect. Apply the current provider rate card to the recorded usage. Add retrieval, tool, and other variable delivery charges. Compare cost per attempt with cost per completed outcome. Break the results down by account and workflow. Investigate outliers rather than deleting them.
Week four: apply one controlled change. Choose a specific intervention, such as reducing unnecessary context, adding a run limit, routing a low-risk step to a cheaper model, improving cache reuse, or changing an allowance. Measure cost and quality before and after using comparable cases. Keep the change only if it improves the outcome you set out to improve.
At the end of the month, document what remains uncertain. You may not yet know the full cost of human review, the long-term cache hit rate, or how a new customer segment will use the feature. State those gaps explicitly and assign owners. A transparent estimate is more useful than a precise-looking figure built on missing data.
Where PADISO fits
We help teams connect AI strategy to operating economics, then build the instrumentation and controls needed to run AI workflows in production. Our platform engineering team can help shape the architecture, while our AI strategy service helps prioritise which workflows deserve investment.
Your next step is to pick one live workflow and calculate its cost per completed outcome using a month of usage data. If you need help assessing readiness across the wider business, take the PADISO AI readiness test.