AI cost per user is the attributable model cost for a defined user population divided by the number of eligible users in the same period. Define “user” first: an analytics visitor, signed-in person, product account, and paying customer are different denominators. Sum provider-reported usage with the correct price version, retain cached and retried usage separately, and expose any unlinked cost.
First decide what “user” means
The right denominator depends on the decision. Google Analytics
defines activeUsers as distinct users who visited a
site or app, while sessions counts sessions that
began. Neither automatically equals a signed-in product user or
paying account.
| Denominator | Best for | Required identity | Main limitation |
|---|---|---|---|
| Active visitor | Acquisition and site-wide economics | Analytics visitor | May include people who never used an AI feature. |
| Signed-in user | Individual product usage | Stable internal user ID | Multiple users may belong to one paying account. |
| Account | B2B product economics | Stable internal account ID | Does not show variation between users in the account. |
| Paying customer | Margin and plan decisions | Account linked to payment customer | Excludes free users unless reported separately. |
Calculate AI cost from observed events
OpenAI response usage separates input and output tokens and can report cached input details. Claude provides a token-counting API and documents separate prompt-cache usage. Keep those categories separate because the effective price may differ by model, cache state, tier, region, and date.
Event AI cost = uncached input tokens × applicable input rate + cache-read tokens × applicable cache-read rate + cache-write tokens × applicable cache-write rate + output tokens × applicable output rate + applicable tool or request fees
Use the provider-returned usage from the completed response. For a streamed response, usage may arrive with the final event or chunk, so the wrapper must finish consuming the stream before it records the total. If your application retries a failed or timed-out call, keep each observed attempt. A retry is not free simply because the user saw one final answer.
Do not put a current model price into the SDK. Send usage and model identity, then apply a versioned server-side price. That preserves the price effective when the event occurred and lets unknown models remain visibly unpriced.
Aggregate events before dividing by users
AI cost per eligible user = sum of attributable AI event cost for eligible users ÷ distinct eligible users in the same period
Keep two totals when identity coverage is incomplete: attributable cost belongs to a known user or account, while unallocated cost was observed but cannot be assigned safely. Do not spread unallocated cost evenly across known users. You may separately report a site-wide average using total cost divided by an analytics population, but label it as a portfolio average rather than customer-level cost.
Worked example: portfolio average vs attributable user cost
This hypothetical example uses one month of data. It is not a benchmark and does not represent a Grow or Die customer.
| Observed item | Amount | Treatment |
|---|---|---|
| Uncached input cost | $240 | Included from priced usage events |
| Cache-read and cache-write cost | $30 | Included separately from uncached input |
| Output cost | $360 | Included from priced usage events |
| Failed and retried attempt cost | $45 | Included where the provider reported usage |
| Total observed AI cost | $675 | $540 linked; $135 unallocated |
| Active users | 50 | 42 have stable usage identity links |
Site-wide portfolio average = $675 ÷ 50 = $13.50 per active user
Known attributable average = $540 ÷ 42 = $12.86 per linked active user
Unallocated cost = $135; do not assign it to the 42 linked users
Both averages are valid answers to different questions. The first describes the whole observed product population. The second describes only users with a trustworthy identity link. Neither justifies claiming that every individual user cost exactly that amount.
What AI cost per user cannot tell you
- It cannot tell you whether a user is profitable without observed revenue linked to the same account or customer.
- It cannot prove which feature caused retention, conversion, or a payment. Cost attribution is not causal attribution.
- It cannot expose missing server events. Reconcile event-priced cost with provider organization reports to detect gaps.
- It cannot compare two periods fairly when the user definition, model price version, currency, or reporting window changed.
- It cannot turn a mean into a distribution. A $13.50 average may hide a small group of extremely expensive users.
To connect the cost to what customers pay, read how to calculate AI contribution margin . For the complete framework, see what AI unit economics means and the AI cost attribution product page.