AI cost per customer is the model, seat and agent spend your product consumed on behalf of one customer in a period. You calculate it by tagging every LLM request with a customer ID, pricing each request at your negotiated rates, including cached and batch pricing, and adding any seats or shared costs allocated to that customer.
What is AI cost per customer?
AI cost per customer is the portion of your AI spend that one customer caused. It is the AI line in cost to serve, and the number you subtract from that customer’s revenue to see their gross margin. For an AI product company, it is the difference between knowing your margin and guessing it from a blended monthly invoice.
Most AI products start with one invoice from each model provider and one revenue number per customer. The two never meet. Without per-customer attribution, you find out when the blended margin moves, months after a customer’s behavior changed.
Two related terms. Cost to serve is everything it costs to serve one customer: AI cost, plus compute, storage, support and third-party APIs. AI gross margin for a customer is revenue minus AI cost, divided by revenue. This post covers the AI part, which for most AI products is the fastest-moving piece of cost to serve.
What is the formula for AI cost per customer?
AI cost per customer is the sum of every request made on that customer’s behalf, each priced at your negotiated per-token rate, with cached input tokens at the cached rate and batch requests at the batch rate, plus any per-customer seats or dedicated capacity, plus that customer’s usage-weighted share of agents and services that serve several customers.
Written out:
AI cost per customer = Σ requests (input tokens × input rate + cached input tokens × cached rate + output tokens × output rate), with batch requests at the batch rate, + seats for that customer + allocated share of shared AI cost
Three details decide whether the number is right:
- Use your negotiated rates, not list prices. Committed-spend discounts, enterprise agreements and cloud marketplace pricing all change the per-token rate. Price each request at what you actually pay for that model through that provider.
- Price cached and batch tokens separately. Prompt caching and batch APIs carry different rates from standard requests. If you price everything at the standard rate, you overstate cost for the customers whose workloads cache well, and your optimization work never shows up in the margin.
- Allocate shared cost by usage, not by headcount. A support agent that serves six customers should be split by the requests each customer generated, not evenly.
How do you attribute LLM requests to a customer?
Attach a customer identifier to every request at the point where your code knows which customer it is serving. The simplest method is a header or metadata field on the model request that carries the customer ID, and optionally the feature name. Store it with the usage record. Every later calculation joins on that field.
The pattern looks like this in practice:
- Your application already knows the tenant on every request. Pass that ID to the model call as a header, for example
x-customer-id: cus_harborandx-feature: search-answers. - Log the response usage (input, cached input, output tokens, model, provider) next to those tags.
- For agents and background jobs, set the tags when the job starts and carry them through every model call.
- For shared services with no single customer, tag the service name and allocate later by usage.
If you cannot change application code yet, start with what you have. API keys per customer or per feature give a coarse split. Provider usage exports by key are enough for a first version of the table. Map in Bloom Factory reads those keys and tags and rolls them up by team, agent, feature and customer, so the customer header is the second step, not a prerequisite.
How do you turn AI cost per customer into cost to serve and gross margin?
Once each customer has an AI cost for the period, add the other costs of serving them and compare to revenue. Cost to serve is the full stack. AI gross margin isolates the model cost, which is useful because it is the piece that moves week to week and the piece your engineering team can change fastest.
For the AI line specifically, two ratios are worth tracking per customer:
- AI cost ratio = AI cost / revenue. The share of each dollar of revenue spent on models and seats for that customer.
- AI cost per user = AI cost / active users at that customer. This shows whether a customer is expensive because they are large or because their users consume more per head.
Set a target for the AI cost ratio by plan. A customer above the target is a candidate for optimization or repricing.
Worked example: AI cost per customer at Northwind Labs
Northwind Labs, our example company, sells an AI product to six customers on two plans. In November 2026 it recorded $13.96K of AI cost against $150.0K of revenue, an AI cost ratio of 9.3%. The spread across customers is what matters: from 5.8% at Meridian Credit Union to 18.0% at Alder Retail. All figures are example data.
| Customer (Example, Northwind Labs) | Plan | AI cost, Nov 2026 | Revenue | AI cost ratio | Users | AI cost per user |
|---|---|---|---|---|---|---|
| Harbor Logistics | Enterprise | $3.42K | $48.0K | 7.1% | 1,260 | $2.71 |
| Pinecrest Health | Enterprise | $2.95K | $36.0K | 8.2% | 940 | $3.14 |
| Alder Retail | Growth | $2.61K | $14.5K | 18.0% | 610 | $4.28 |
| Quill Legal | Growth | $1.88K | $12.0K | 15.7% | 220 | $8.55 |
| Meridian Credit Union | Enterprise | $1.74K | $30.0K | 5.8% | 480 | $3.63 |
| Copperline Energy | Growth | $1.36K | $9.5K | 14.3% | 175 | $7.77 |
| Total | $13.96K | $150.0K | 9.3% | 3,685 | $3.79 |
Two patterns stand out. The three Enterprise customers run between 5.8% and 8.2%. The three Growth customers run between 14.3% and 18.0%. The Growth plan is priced too low for its AI usage, or its users are doing something more expensive per request. Quill Legal has the highest cost per user at $8.55, with only 220 users, which points to heavy per-user usage rather than scale.
The ledger shows what sits behind one of these numbers. On Nov 21, a single entry for Harbor Logistics records 18,420 requests from the Support resolver agent on claude-sonnet at $322.35, with $161.20 saved on those same requests through routing and caching. That is $0.0175 per request after optimization. Pinecrest Health’s Search answers feature, running on gemini-flash, cost $136.37 for 40,110 requests the same afternoon, or $0.0034 each.
What do you do when a customer runs below margin?
When a customer’s AI cost ratio is above target, you have four levers, in this order: lower the cost per request for their workloads, cap or shape usage inside the plan, move them to a plan priced for their usage, and talk to them. Start with cost per request because it is invisible to the customer.
Take Alder Retail at 18.0%. The options:
- Route and cache. Most of Alder’s requests go through the Ticket summarizer on gpt-5-mini. Routing simpler requests to a cheaper model and caching repeated context lowers cost per request with no product change. Across Northwind’s agents, cost per request after optimization runs 24% to 44% lower than before. Optimize in Bloom Factory measures the saving per request, so you can show it in Alder’s margin the next month.
- Set a usage budget per plan. A Growth plan budget with an alert at 80% tells your team before the month closes. A hard cap, if your terms allow one, protects margin on the worst outliers.
- Reprice or tier. If Growth customers consistently run at 14% to 18% while Enterprise runs under 9%, the Growth plan price or its included usage is wrong. Use the per-customer table to set the new tier, not a blended average.
- Talk to the customer. A customer at $8.55 per user often has a workflow worth understanding. Sometimes it is a feature you should charge for.
Frequently asked questions
These are the questions AI product teams ask most when they start measuring cost per customer. Short answers follow. For the full method and the SDK path, see our AI products solution, or book a free 30-day AI Scan and get cost per customer for your own product with read-only connections to start.
Do I need a proxy or gateway to get AI cost per customer?
No. If each customer or feature has its own API key, provider usage exports already give you a split. A customer header on each request is more precise and lets you split shared agents by usage. Bloom Factory starts read-only and adds the header path when you want request-level detail.
How do I handle prompt caching and batch pricing in the formula?
Price them at their own rates. Provider usage records flag cached input tokens and batch requests. Multiply each by the rate you pay for that category. If you price everything at the standard rate, your reported cost will be higher than your invoice, and your caching work will never show up in margin.
What AI cost ratio should I aim for?
It varies by product and plan. The useful move is to set a target per plan from your own data, then watch the customers above it. In the Northwind example, Enterprise customers run under 9% and Growth customers run 14% to 18%, which says more about plan pricing than about any one customer.