AI cost per customer, and the margin it leaves
The CostReveal team, , 3 minute read
A software company selling an AI feature has a question its AI bill cannot answer: what does each customer cost to serve? The bill says what each model cost each day. It cannot say which customer a call was for, because only your application knows that. When every customer shares one API key, the most expensive customer and the cheapest look identical on the invoice. This post is about how CostReveal answers the question exactly, and where it stops.
Why the bill cannot say
Providers bill by key, project or workspace. A product that serves many customers through one key gets one line per model per day. Tags do not help: a tag sits on a resource, and here the resource is shared. The only place the customer is known is the request itself.
Usage data: what your application already reports
Your application, or the AI gateway in front of it, already knows who each call is for. CostReveal reads that from what you already emit:
- OpenTelemetry GenAI spans, from your application or a gateway such as LiteLLM, with the customer, feature or user as attributes;
- a gateway's own logs, from LiteLLM, Helicone or Portkey, read with a key that can read them;
- a usage events endpoint, for calls no telemetry covers.
Each call is counted with its model and tokens, and who it was for. No prompt or response content is read, and identifiers are what is sent, never email addresses. CostReveal never sits between your application and the provider: nothing is slowed or blocked, and if usage data stops arriving, your application carries on exactly as before.
Divided, never invented
CostReveal then divides the billed cost of each model, each day, in proportion to the tokens each customer's calls used. Four rules keep that honest:
- Only billed spend is divided. Totals stay exactly what the provider billed; usage data never adds a cent.
- Only what it covers. If your data reports 60 percent of the tokens a model was billed for, 60 percent of that model's unexplained cost is divided, and the rest stays Not yet explained.
- Tags and owners come first. A workspace already owned by a team keeps that owner; usage data divides only what is still unknown.
- The basis says so. Cost divided this way is labelled allocated, split by measured usage share.
Today this division is built for Anthropic, whose usage report states tokens by kind, which the division needs. OpenAI follows once its line item names are certified against a real organization's report, and other providers as their connectors are.
From cost per customer to margin
With usage data arriving, Business shows what each feature, customer and user cost, beside the calls made for them, and Home shows the month's cost per active user and per call.
Connect Stripe, and Business sets each customer's revenue beside their cost, for gross margin by customer, and Home shows the month's gross margin. Revenue is matched to customers the way costs are, by the Stripe customer's metadata read with your project's tag keys, so a customer tagged customer = globex is the same customer in both. Revenue is kept apart from spend: it never changes a cost figure.
A customer with no matching metadata is shown as not mapped, never guessed from a name.
Who this is for
Founders pricing an AI feature, finance teams asking whether the largest customer is the most profitable, and engineering teams deciding which customer's usage pattern to optimize first. The figures are the same ones Explore shows, so the margin conversation and the engineering conversation start from one number.
Frequently asked questions
Does CostReveal need an SDK in my application? No. It reads OpenTelemetry your application or gateway can already emit, gateway logs, or a usage events endpoint.
Does it read prompts? No. Only the model, the tokens and who the call was for.
What if my usage data covers only some calls? Only the share it covers is divided; the rest stays not yet explained.
Which providers are divided today? Anthropic. OpenAI follows once its line items are certified against a real organization.
How is margin calculated? Each customer's Stripe revenue, minus the cost CostReveal attributes to them, matched by the same tag keys.
Can it slow my application down? No. It never sits in the path of your calls.
Keep reading
- Connecting Anthropic to CostReveal: the admin key, and naming workspace owners.
- Connecting Stripe to CostReveal: revenue beside cost, for margin by customer.
- Why CostReveal shows the spend it cannot explain: how uncovered spend stays in the open.