Metric · LLM analytics

What is LLM cost per user, and how do you track it in Metabase?

Definition

LLM cost per user is total LLM spend divided by the number of users who actually used LLM-powered features in the window. It's the unit-economics headline for AI features: paired with revenue per user, it answers whether the AI functionality is a margin story or a cost problem — and its distribution shows whether a few power users are carrying the whole bill.

Formula: SUM(cost_usd) ÷ COUNT(DISTINCT user_id with ≥1 LLM request), per month — with the per-user distribution alongside the mean

What data do you need?

  • User- or tenant-grain daily rollups: user_id, requests, tokens, cost
  • A consistent user or tenant ID shared with product analytics
  • Plan or segment attributes for the join (free vs. paid changes the story)
  • Feature tags if cost per user should split by AI surface

SQL pattern

Cost per active user and the p95 user, by monthPostgreSQL
WITH user_months AS (
  SELECT
    date_trunc('month', window_start) AS month,
    user_id,
    SUM(cost_usd) AS user_cost_usd
  FROM llm_user_rollups
  WHERE environment = 'production'
  GROUP BY 1, user_id
)
SELECT
  month,
  COUNT(*) AS active_users,
  ROUND(SUM(user_cost_usd), 2) AS total_cost_usd,
  ROUND(AVG(user_cost_usd), 4) AS mean_cost_per_user,
  ROUND(
    percentile_cont(0.95) WITHIN GROUP (ORDER BY user_cost_usd), 4
  ) AS p95_cost_per_user
FROM user_months
GROUP BY month
ORDER BY month;

Common pitfalls

Dividing by all product users instead of AI-feature users.→ A wide denominator flatters the number and hides the real question. Use users with at least one LLM request; report AI-feature adoption separately.
Reporting only the mean.→ LLM usage is heavily skewed — a handful of power users often drive most of the spend. Show p95 and the top-users table next to the mean, and consider per-plan caps informed by them.
Losing the user ID between the gateway and product analytics.→ Per-user economics need the same ID on both sides. Propagate your product user or tenant ID into LLM request metadata at the source — retroactive joins rarely work.
Comparing cost per user across plans with different features.→ Enterprise users hitting bigger models aren't 'less efficient' — they're on a different product. Segment by plan and compare within, not across.

Where does this metric apply?

This metric commonly uses data from Helicone user rollups, Langfuse traces with user IDs, OpenRouter API-key rollups, product analytics joins, plus any warehouse models that provide the same grain of LLM usage data.

Dashboards

Integrations

Metrics

Analytics

FAQ

How do you calculate LLM cost per user?
Total LLM spend in the window divided by distinct users who made at least one LLM request. The data needs user IDs on the requests — tools like Helicone and Langfuse accept a user field per request, which flows into the rollups this metric reads.
What's a good LLM cost per user?
One your revenue per user comfortably covers — there's no universal benchmark, because a $2/month cost is fatal for a $5/month plan and a rounding error at $500. The useful outputs are the trend, the plan-level comparison against plan revenue, and the p95 user that pricing and rate limits should be designed around.
Should free-tier users be included?
Include them, but segmented — free users' LLM cost is your acquisition spend and deserves its own line against conversion rate, not a blend into the paid unit economics. The adoption & unit economics dashboard keeps the split explicit.