Skip to content

Gross margin for an AI product: what it costs to serve each customer

The CostReveal team, , 4 minute read

Ordinary software costs about the same to run whether a customer uses it a little or a lot. An AI product does not. Every summary, search and agent step is a model call with a price, so the customer who uses the product most can cost the most to serve, and a flat price can hide a customer you lose money on. Gross margin by customer is how to see it. This post covers what goes into the cost of serving a customer, how to measure it from your real bills, and how to set it against revenue.

What belongs in the cost to serve

The cost of serving a customer is everything you spend because that customer uses the product. For an AI product it usually has four parts:

  • Model tokens, billed by Anthropic, OpenAI and other AI providers, often through one API key shared by every customer.
  • AI on a cloud bill, such as Amazon Bedrock, Azure OpenAI or Gemini, billed with the rest of your cloud.
  • The infrastructure around the model: compute, databases, storage and a Kubernetes cluster serving many customers at once.
  • The services the product runs on, such as observability, messaging and the edge, whose bills rarely name a customer.

Each arrives on a different bill, in a different shape, and almost none of them say which customer it was for.

Measuring it customer by customer

CostReveal explains each line of each bill on a basis that says how sure it is, and the customer dimension draws on all of them:

  • Tags. A cloud resource tagged customer = cust-1042 is that customer's, with the INFERRED basis.
  • Named owners. An AI workspace or project you name as a customer's explains its spend the same way.
  • Usage data. Calls your application reports, each with the customer it served, divide shared Anthropic and OpenAI spend by each customer's tokens, as ALLOCATED.
  • Kubernetes. A workload labelled with its customer takes its share of each node's cost, by what it requested or used.
  • Allocation rules. A shared cost, such as a database every customer uses, is split by a rule you can inspect, as ALLOCATED.

Spend that none of these explain stays Not yet explained, its own row, never spread across customers to make the margin look complete. A margin built on guessed cost is worse than no margin at all, because it is believed.

Revenue, counted as finance counts it

With Stripe connected, revenue is what each customer was billed:

  • Invoices that are open or paid, excluding tax. Drafts, voided and uncollectible invoices are not revenue.
  • Credit notes that are issued, taken off the customer they were for.
  • Charges that succeeded without paying an invoice, less what was refunded, so nothing is counted twice.

Revenue is matched to customers the way cost is, by the Stripe customer's metadata, read with the same tag keys. A customer whose metadata says customer = cust-1042 is the same customer as the resources tagged that way. A Stripe customer with no matching metadata is shown as not mapped, never matched by name. Revenue is kept apart from spend and never changes a cost figure.

Gross margin, and what it shows

Gross margin is revenue less the cost to serve. Business, under Customers, shows each customer's revenue, cost and margin, with the period's totals, and Home shows the month's gross margin. Cost no customer explains yet is its own row, so the margin never claims more coverage than it has.

Read customer by customer, it answers the questions a single company margin cannot:

  • Which customers cost more than they pay, and by how much, beside what they pay.
  • Which features drive the cost. Business sets each feature beside the customers it served, and its cost per customer.
  • Whether pricing fits usage. A plan whose margin falls as usage grows is priced for seats while the cost grows with calls.

Making the margin trustworthy

A margin is only as good as its coverage. Three habits keep it honest:

  1. Report the customer on every AI call. Usage data divides only what it covers; the rest stays unexplained.
  2. Tag what serves one customer. A dedicated database or bucket tagged with its customer is explained directly.
  3. Write rules for what is shared. A rule says plainly how a shared cost is split, and every figure it explains says so.

Home's next best action names the one change that would explain the most spend, so coverage grows where it matters most.

Frequently asked questions

What counts as the cost to serve a customer? Everything spent because the customer uses the product: model tokens, AI on cloud bills, the infrastructure around the model and the services it runs on, as far as each is explained to that customer.

Is unexplained cost spread across customers? No. It stays its own row, so no customer's margin is made up.

How is revenue matched to a customer? By the Stripe customer's metadata, read with the same tag keys as your costs.

Does revenue change any cost figure? No. Revenue is kept apart from spend.

Do I need Stripe for cost per customer? No. Cost per customer comes from your bills and usage data; Stripe adds revenue for the margin.

Keep reading