Skip to main content

How I track AI cost per user against RevenueCat revenue (open-source)


Forum|alt.badge.img

If your app has an AI feature behind a RevenueCat subscription, you probably have flat revenue per user and a variable AI cost per user. A light user costs cents; a heavy user (or one stuck in an agent loop) can cost more than they pay. The AI invoice shows tokens, RevenueCat shows revenue, and nothing joins them per user.

 

Disclosure: I built a small open-source tool for this, FiscaLLM (MIT). Sharing how it works in case the approach is useful, even if you build your own.

 

How it works:

1. Your backend reports usage after each AI call (model name and token counts only, never prompts or answers), keyed by your RevenueCat app user ID.

2. A RevenueCat webhook reports payments, and RevenueCat aliases are resolved so anonymous and logged-in IDs merge into one user.

3. You see margin per user, per plan and per free trial, plus which model or feature drives the bill, with budget alerts (email, Slack, webhook) and optional spend caps.

 

Two things I learned the hard way: use the same ID for RevenueCat and your AI usage events from day one, and treat free trials as their own cohort, because that is where heavy users hide.

 

Limits: it needs a backend between your app and the AI provider, so apps calling the AI API straight from the phone are not covered. No customers yet, and the demo dashboard runs on sample data.

 

Demo (no sign-up): https://fiscallm.com/demo?utm_source=revenuecat&utm_medium=community&utm_campaign=launch

Code: https://github.com/magna56/fiscallm

 

I'd like to hear how others here handle AI cost per user, and what would make this more useful.