A $0.03 request reads as cheap until a $20-per-month customer sends 2,000 of them: $60 of inference before cloud, support and payment fees. That customer is unprofitable three times over, and the dashboard showing blended cost per million tokens will never say so. AI revenue can climb while the economics beneath it decay, usually because a team tracks token prices while selling seats, tasks, documents or outcomes.
The price per token (a small piece of text the model reads or writes) is only one part of the margin on each unit. The question that decides the business is narrower. What does it cost to deliver one unit of value the customer pays for, and how is that cost spread across customers? A writing assistant sells an approved draft. A support copilot sells a resolved conversation. An API sells a finished workflow. A seat works as the unit only while usage per seat stays limited.
Every request needs a price tag before it can be summed
The business unit is one customer for one month. The cost of running the AI model belongs in the variable cost of serving that customer, next to payment fees, document search, human review, tools and servers. Getting there starts with a log that records the cost of every single call.
The ledger comes together in a fixed order:
- Start from a request ledger that rolls up into any business unit you care about.
- For each call, compute inference cost as input tokens times the input rate, plus output tokens times the output rate, plus cache and batch charges, tool charges, and an allocated share of platform cost.
- Match every rate to provider, model, region, tier, and billing date, and store the rate table you used: OpenAI, Anthropic, and Google Cloud Vertex AI publish list prices, but negotiated contracts differ.
Written as one line, the per-call formula the ledger stores is:
Request cost = input tokens × input rate + output tokens × output rate + cache and batch charges + tool charges + allocated platform cost
At rates of, say, $3 per million input tokens and $15 per million output tokens, a call with 6,000 input and 800 output tokens costs 0.018 + 0.012 = $0.030 before tools and platform share: the $0.03 request from the opening.
The platform share covers shared costs: document search, turning text into vectors, storage, orchestration, monitoring, your own GPUs and data transfer. Don't split it equally when requests differ. Split it by what actually causes the cost, such as search calls, computing seconds or stored vectors. A long-document feature that makes 40 search calls per request should carry forty times the search cost of a chat message that makes one.
Failed calls, retries, safety rejections and tool loops all count, because you pay for them even when the user sees nothing. An agent that retries a broken tool call three times costs four calls, not one. When you promise a finished task, divide all relevant AI cost by the number of tasks that were actually completed, and write down what "relevant" means. Count handoffs to a human when you promise a resolution. Leave them out when you sell help with drafting. What you promise the customer sets the boundary, even when the data would be easier to cut another way.
The denominator is the unit the customer buys
Add costs up to a unit the customer recognizes, and keep a separate working unit for finding problems. The pricing model picks the unit. For seat-based SaaS, compare profit per active paid seat with profit per paid seat. The gap shows unused seats and heavy users. Pay-per-use APIs are easier to read as margin per successful workflow or document. Count each result the customer sees once, but keep the cost of every paid attempt behind it.
Products priced by result measure cost per resolved ticket or approved item, and fix the rule for what counts as resolved before launch. Mixed plans keep subscription and overage profit apart. If you blend them, you hide an included allowance that loses money while overage charges happen to cover it, until a change in overage prices exposes it.
Contribution margin is revenue minus the variable cost of serving the customer. Divided by revenue, it gives the percentage. Gross margin may also include wider staff and shared server costs, depending on your accounting rules. For decisions about features and pricing, contribution margin is the better guide, because it isolates the costs that move with usage.
Input and output costs hide in different places
To learn why an account is expensive, split the bill. Input cost carries system prompts, conversation history, retrieval chunks and tool results. Output cost carries requested length, reasoning settings, regenerations and stopping rules. A blended token metric hides both. Each call should therefore record the account, plan, feature, route and model, plus separate fields for input, cached input, output and reasoning tokens, retries and outcome.
Do not log raw prompts by default to measure cost. They may hold personal, confidential or regulated data, and token counts, metadata and governed sampled traces usually suffice.
Context growth is the most common leak, and it compounds. A chat that resends full history makes turn 20 carry the input of turns 1 to 19. If each turn adds 500 tokens, turn 20 sends about 10,000 input tokens and the whole conversation sends about 105,000, against 10,000 if each turn stood alone. Retrieval can append documents nobody reads. Where you can detect it, measure the ratio of retrieved to cited content and track cost by turn. Rising cost per turn against flat success is the signature of prompt or retrieval waste.
Margin is read per account-month
Request costs mean little until they sit next to revenue, and revenue arrives per account per month. Fix the time basis before aggregating: requests also land on trials, refunds and post-cancellation access. Sum request costs for an account across the month and subtract them from recognized revenue to get account-month margin.
A synthetic example makes the sensitivity concrete. A $49 plan recognizes $49 a month and incurs $18 in model charges, $3 in retrieval and orchestration, $1 in payment fees and $2 in usage-linked support. Contribution is $25, a 51 percent margin. Let routing push model charges to $30 with no price change, and contribution falls to $13, or 26.5 percent. Neither figure is a target. Acceptable margin depends on sales motion, fixed costs, retention and pricing power. The example shows why an adoption chart means little without a margin chart beside it.
Averages hide the accounts that decide the result. Take a $20 plan where 80% of accounts cost $3 a month, 15% cost $12 and 5% cost $60. The mean is $7.20, a comfortable 64% contribution before other costs. The top 5% each lose $40 a month, and together they consume $3.00 of the $7.20 average, over 40% of total AI spend. Report the median, the 90th and 95th percentile of customer cost, and the revenue those top accounts consume, beside the mean.
Price the tail, then the mean
Fixed-price plans live with heavy-tailed usage. A small share of accounts generate long contexts, repeated generations, file processing or tool-heavy workflows, and pricing on mean token spend hands that uncapped risk to the vendor. Copying a competitor's allowance skips the one input that matters: your own account-month cost distribution.
Plot revenue, AI cost and contribution by plan, then inspect expensive accounts one by one. Some get proportionally more value and are a segment worth packaging. Some carry legitimate volume. Some expose a defect, such as a retry loop. A few abuse the product. Each answer points to a different action.
In the $20 example, an included allowance sized at the 95th percentile of the other 95% and transparent overages beyond it would turn the $40 loss accounts into either paying customers or capped ones. Other controls work the same way: feature limits, plan-based queue priority, spend caps, a higher operational tier. Set a per-account margin floor that triggers a product or support review, and a portfolio floor that informs price and model choices. Weigh the full relationship before throttling. An expensive customer who expands to forty seats next quarter is the wrong one to cap.
Routing makes quality part of the denominator
Within one customer's month, the "average request" doesn't exist. Sorting, pulling out data, summarizing long documents, coding and agent tasks all use different amounts of tokens and need different quality. An expensive model can be right for valuable tasks and wasteful for simple ones. Build a view by task type: share of traffic, cost per request, success rate and the value that follows, such as paid conversion, retention or agent minutes saved.
Treat a model change as a hypothesis you can test. For example: move short data extraction from model A to model B. Cost per successful extraction should fall, while checked accuracy and completion stay within limits set in advance. Teams often forget quality in the calculation. Cost per call divides AI cost by the number of calls. Cost per accepted result divides it by the number of accepted results. The second can rise while the first falls. If a cheaper model costs 60% less per call but needs 2.5 tries per accepted result instead of 1, the cost per accepted result doesn't change, and users wait longer.
Waiting time follows the same math. Jeffrey Dean and Luiz André Barroso showed in "The Tail at Scale" (Communications of the ACM, February 2013) that if one server answers slowly once in a hundred times, a request that goes to a hundred such servers is slow about 63% of the time. An agent that chains document search, two model calls and a tool call inherits the slowest step at every hop. The slowest 1% of whole workflows decides how many retries and timeouts end up on the bill, much more than the typical speed of any single call.
Cohorts show what the tail does as accounts age
A price change caps the tail as it looks today. How it behaves as accounts age is a cohort question. First-month economics are distorted by trials, onboarding, imports and experimentation. Mature accounts can cost less as workflows settle, or more as engaged customers reach for advanced features. Only cohorts show which.
Group accounts by acquisition month, plan and channel, and at each age measure retained accounts, recognized revenue, AI cost, contribution and expansion. Hold definitions fixed: comparing a 30-day cohort with a 12-month cohort without adjusting for age confuses lifecycle with quality.
Acquisition has its own trap. Low-CAC traffic can activate into token-heavy, weak-retention use cases while a higher-CAC channel retains, expands and contributes. Compare CAC against expected lifecycle contribution; first-month revenue flatters the cheap channel. CAC payback in months is CAC divided by monthly gross-margin contribution. A $150 CAC paid back by $25 a month takes six months; the same customer after the routing change in the $49 example contributes $13, and payback stretches past eleven.
A common reason to skip all this instrumentation is that list prices for a given capability tier have kept falling, so a team could ship features and let the price curve fix the margin. For a product with bounded usage per account and no agentic loops, that is a fair bet: waiting costs less than the engineering. Where cost is driven by volume, context length and retries, the bet fails, because those grow with adoption faster than a price cut arrives, and a cheaper rate applied to a runaway loop is still a runaway loop.
Instrument the ledger, then test against it
Connect billing data, product events and the CRM with one request ID that travels through the app, the model gateway, tools and logs. Link it to a workspace or account before it reaches the data warehouse. Give anonymous visitors a temporary ID and match it later by a written rule. Four tables do most of the work:
- one row per request;
- one row per account per day;
- one row per account per month, with revenue and margin;
- a price table with the dates each price applied, token prices, cache rules and how shared costs are split.
Every month, check your calculated cost against the provider's invoices. A gap of a few percent usually comes from cut-off dates, credits, currency or taxes. A bigger gap needs looking into before any dashboard drives a decision. Then treat every cost-saving change to the AI as a product change, judged by margin and quality. Token savings alone prove nothing. The common levers each pay off only within limits:
- Prompt compression trims input on long, repetitive contexts, but drops facts the moment the summary omits a detail the task needed.
- Smaller models hold up on classification and extraction, yet create corrections and rework once reasoning or long-document synthesis is on the line.
- Response limits cut runaway output, though they clip completion when the answer legitimately needs the length.
Pick a primary metric such as contribution per eligible task. Put guardrails on completion, validated quality, latency and seven-day return. Randomize by account where shared workspaces would contaminate user assignment, and report absolute and relative change together: $0.40 to $0.34 per accepted task is $0.06 and 15 percent. Ship only when practical significance justifies the quality risk.
Denominators that drift without anyone noticing do more damage than any price change. The paid unit gets redefined after launch, or a model change lowers cost per request while raising the requests needed per accepted outcome. Keep the definitions, rate-card version and allocation method next to the dashboard, where the person reading it will see them. Then compute one number by hand: the contribution of the 95th-percentile account on your cheapest plan. If it is negative, that plan needs an allowance before it needs a cheaper model.