LLM gross margin is revenue minus the model cost of producing it, divided by revenue. For an AI startup it is the fastest-moving line in gross margin and the one engineering can change. You measure it per customer and per feature by attributing every model request, then improve it with routing, caching, compaction, pricing tiers and usage caps.
What is LLM gross margin?
LLM gross margin is the share of revenue left after paying for the model calls that produced it. It isolates inference cost from the rest of cost of goods sold: hosting and support. Full gross margin subtracts all of those. LLM gross margin subtracts only the model bill, so you see what prompts, models and traffic do to the business.
LLM gross margin = (revenue minus LLM cost) / revenue
LLM cost means every dollar paid to model providers for the requests that served customers: API tokens at your negotiated rates, cached and batch tokens at their own rates, cloud-hosted model usage, and any model-related seats or dedicated capacity. It does not include your own engineers’ coding agent spend, which is an operating expense, not cost of goods sold.
Why isolate it? The other COGS lines move slowly. Inference cost moves with every prompt change, every model release and every customer who finds a new way to use the product. If full gross margin dropped four points last quarter, LLM gross margin tells you whether it was the models or something else.
How do you calculate LLM gross margin per customer and per feature?
Attribute every model request to a customer and a feature, price it at your rates, and sum by period. Then divide each customer’s LLM cost by that customer’s revenue, and each feature’s LLM cost by the revenue you assign to it. The blended company number hides the spread. The per-customer and per-feature numbers show where margin is made and lost.
The attribution step is the hard part and the one most teams skip. The pattern:
| Step | What to do | Output |
|---|---|---|
| 1. Tag requests | Pass a customer ID and feature name on every model call, as a header or metadata | Usage rows with customer and feature |
| 2. Price requests | Multiply input, cached input and output tokens by your rate for that model and provider | Cost per request |
| 3. Allocate shared cost | Split agents and services that serve several customers by the requests each generated | Cost per customer, complete |
| 4. Join revenue | Pull monthly revenue per customer from billing; assign feature revenue by plan or usage | LLM gross margin per customer and per feature |
Per-customer margin tells you who to reprice or optimize. Per-feature margin tells you which parts of the product cost more than they earn. Both come from the same tagged request data. Map in Bloom Factory does steps 1 to 3 from read-only provider connections and request tags, so the join to revenue is the only step left for finance.
What does a good LLM gross margin look like?
Good varies by product. The best available benchmark covers full AI product gross margin, not LLM margin alone: in ICONIQ’s 2026 State of AI snapshot, surveyed AI companies expected gross margins to reach about 52% on average in 2026. LLM gross margin on its own should sit well above that, since it excludes other COGS.
The ICONIQ figure is worth reading carefully. It is an expectation from surveyed companies, it covers the whole gross margin line, and it is an average across very different products. Source: ICONIQ, 2026 State of AI: Bi-Annual Snapshot, citing survey data from April and December 2025.
What that means for your own target:
- If your full gross margin is near the ICONIQ average and your LLM cost is most of your COGS, your LLM gross margin is the lever that gets you to software-like margins.
- If your LLM gross margin is high but full gross margin is low, the problem is elsewhere in COGS, and model optimization will not fix it.
- Whatever the blended number, the spread across customers and features is where the action is. A company at 90% LLM gross margin overall can have a plan tier running at 80% that loses money once the rest of COGS is counted.
Set a target per plan from your own data rather than from a benchmark, then manage the customers and features that fall below it.
Which levers improve LLM gross margin?
Five levers move LLM gross margin: routing each request to the cheapest model that meets the standard, caching repeated context, compacting prompts and histories, pricing tiers that match usage, and caps that stop outliers. The first three lower cost per request without touching the product. The last two change what customers pay or can consume.
| Lever | What it does | How it shows up | Northwind Labs saving, Nov 1 to 21, 2026 (Example) |
|---|---|---|---|
| Routing | Sends each request to the cheapest model that can do the job | Lower cost per request, same output | $14.2K |
| Caching | Reuses repeated prompt context at the cached token rate | Lower input cost; hit rate per feature | $11.8K |
| Compaction | Shortens prompts, histories and retrieved context | Fewer input tokens per request | $7.6K |
| Unused seats | Removes model-related seats nobody uses | Lower fixed AI cost | $5.1K |
| Budget limits | Stops retry loops and runaway agents | Avoided spend | $2.3K |
| Pricing tiers | Matches plan price and included usage to actual cost | Higher revenue per unit of cost | Varies by product |
| Usage caps | Limits consumption per plan, with alerts before the cap | Fewer outliers below margin | Varies by product |
Routing is the largest lever for most AI products because most requests do not need the model they were written for. Our design partner Fraimworks cut LLM costs 75 to 90% across its workloads with routing alone, measured per request against the model requested, with no change to its product. Caching comes next and depends on how repetitive your context is. The Optimize module applies the first three and measures the saving on every request.
Pricing tiers and caps are a product decision, but they should be made from the per-customer table, not a blended average. If your Growth plan runs at a lower LLM gross margin than Enterprise across every customer, the plan is mispriced, and no amount of routing fixes a pricing problem.
Worked example: LLM gross margin at Northwind Labs
Northwind Labs, our example company, serves six customers. In November 2026 it recorded $13.96K of LLM cost against $150.0K of revenue, an LLM gross margin of 90.7%. The spread is wide: 94.2% at Meridian Credit Union and 82.0% at Alder Retail. Every Growth plan customer sits below every Enterprise customer. All figures are example data.
| Customer (Example, Northwind Labs) | Plan | Revenue, Nov 2026 | LLM cost | LLM gross margin |
|---|---|---|---|---|
| Harbor Logistics | Enterprise | $48.0K | $3.42K | 92.9% |
| Pinecrest Health | Enterprise | $36.0K | $2.95K | 91.8% |
| Meridian Credit Union | Enterprise | $30.0K | $1.74K | 94.2% |
| Alder Retail | Growth | $14.5K | $2.61K | 82.0% |
| Quill Legal | Growth | $12.0K | $1.88K | 84.3% |
| Copperline Energy | Growth | $9.5K | $1.36K | 85.7% |
| Total | $150.0K | $13.96K | 90.7% |
The company-level 90.7% looks healthy. The table says the Growth plan is the problem: 82% to 86% against 92% to 94% for Enterprise. Once hosting, support and the rest of COGS are subtracted, Growth customers may be near or below zero.
Now the per-feature view. Northwind’s agents report cost per request before and after optimization:
| Feature or agent (Example, Northwind Labs) | Model | Cost per request before | After | Change |
|---|---|---|---|---|
| Search answers | gemini-flash | $0.0061 | $0.0034 | 44% lower |
| Ticket summarizer | gpt-5-mini | $0.0094 | $0.0057 | 39% lower |
| Support resolver | claude-sonnet | $0.0262 | $0.0175 | 33% lower |
Search answers carries a 38% cache hit rate, which is most of its 44%. The Ticket summarizer serves Alder Retail, so its 39% improvement lands directly in the margin of Northwind’s lowest-margin customer. That is what per-feature attribution buys you: a lever that points at a specific customer’s margin. In total, Northwind has saved $41.0K across routing, caching, compaction, seats and guardrails through Nov 21, against $184.0K of spend from all sources.
Frequently asked questions
These are the questions founders and finance leads at AI startups ask most about LLM gross margin. Short answers follow. For the per-customer method in detail, see our AI products solution, or book a free 30-day AI Scan and get LLM cost by customer and feature from read-only connections.
Is LLM gross margin the same as gross margin?
No. LLM gross margin subtracts only model cost from revenue. Gross margin subtracts all cost of goods sold, including hosting, support and third-party services. Track both. LLM gross margin tells you what inference is doing to the business; full gross margin is what your board and investors will ask for.
Should coding agent spend count against LLM gross margin?
No. Coding agents used by your own engineers are an operating expense, like any developer tool. LLM gross margin covers model cost incurred to serve customers. Keep the two separate, or your margin will move every time the engineering team adopts a new tool.
What LLM gross margin should an AI startup target?
It varies by product. ICONIQ’s 2026 snapshot puts expected full gross margin for surveyed AI companies at about 52% on average in 2026, and LLM gross margin should sit well above that since it excludes other COGS. Set a target per plan from your own per-customer data, then manage the customers below it.