Here is the structural problem with selling anything built on an LLM: your cost is a variable that moves with every token, and your price is almost always a fixed number a customer agreed to once. Most other software has this luxury too — the marginal cost of one more API call is basically zero — but AI features don't. Each request has a real, non-trivial, usage-scaled cost, and if you price like a normal SaaS company, the gap between your flat price and your floating cost is exactly where the money leaks out.

The short answer: compute gross margin as (price − token cost − other COGS) ÷ price, and remember that the token-cost term is the only one that scales with how hard a customer uses you. Price against your heaviest accounts, not your average one — because with AI, the average is a comforting lie and the tail is where you go underwater.

The one formula, and the one term that matters#

Gross margin on an AI feature is the ordinary formula:

margin % = (price − COGS) / price
COGS     = token_cost + per_request_infra
token_cost = input_tokens × input_rate + output_tokens × output_rate

Everything except token_cost is roughly fixed per request. token_cost is the live wire. And two properties of it trip up founders:

  1. Output is the expensive half. Across current-generation Claude models at July 2026 list price, output tokens cost about input tokens — Sonnet 4.6 is on the order of $3 per million input tokens and $15 per million output, Haiku 4.5 roughly $1 and $5. A feature that generates long responses is dominated by its output, so a "cheap" model with verbose answers can cost more than an "expensive" one that's terse.
  2. It scales with the customer, not with you. Your rent, your salaries, your fixed infra don't care whether a given account sends ten requests or ten thousand. token_cost does. That single fact is why AI unit economics behave unlike normal SaaS.

Work one example. Say your product turns a prompt into a structured report, and a typical report is 4,000 input tokens and 2,000 output tokens on Sonnet. That's 4000/1e6 × $3 + 2000/1e6 × $15 = $0.012 + $0.030 = $0.042 per report — about four cents. Charge $0.50 a report and you're at ~92% gross margin. Comfortable. Until you meet the customer who runs 300 reports a day and is on your $99/month flat plan.

The trap: you price for the average, you pay for the tail#

Token spend per account is almost never uniform — it's long-tailed. A handful of power users each burn many times the median. Picture the same report product on a flat $99/month "unlimited" plan:

And here's the cruelty: the p95 user is getting enormous value, so they are the least likely to churn. Flat pricing doesn't just lose money on the tail — it retains the accounts it loses money on and sheds the cheap ones. You have built a machine that selects for your most expensive customers.

Pricing for the average is the default mistake because the average looks healthy in the dashboard. The heavy tail is where the P&L actually lives.

Flat pricing on a usage-scaled cost is a bet that no customer will use you as much as they possibly can. The customers who love you most will take that bet every time.

Four models that survive a power user#

The fix is to let the variable cost show up somewhere in the price — or to cap it. Four shapes, from the compare table above:

Whichever you pick, meter the unit of value, not raw tokens. Customers understand "per report," "per agent run," "per 1,000 actions." They do not want to think in tokens, and pinning your price to tokens couples it to a model choice you might change next quarter. Size the value-unit's token cost with a buffer, price the unit, and keep the token accounting on your side of the wall.

Before you reprice, drop the floor#

Repricing is slow and it annoys customers. Cutting cost is fast and invisible. Do the cost work first — every cent off the floor is margin you keep on every account you already have:

The rule to price by#

Set your price against your p95 cost per account, not your average — and leave a buffer above it for the heavier user you haven't onboarded yet. The average tells you whether the business looks good this month; the tail tells you whether it survives its best customers. Get the cost floor down with caching and batching, choose a model that lets the variable cost surface in the price or a cap that contains it, and meter the value-unit rather than the token. Do that and a power user becomes the best thing that can happen to you instead of the account you quietly dread. For the deeper build-vs-buy version of the same math, see self-hosting inference vs API cost.