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.

6 replies

wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • October 23, 2026

Hi ​@ficallm! My name is Wes, a member of RevenueCat’s Developer Support Team. I came across this post and it sounds like a really useful third-party tool for other AI apps also using RevenueCat! We appreciate you sharing it with the community.

I also wanted to point you in the direction of our documentation on getting an OAuth client registered for use by a third-party integration. I am not sure what your plans are for building this tool out further, but it might be helpful in making onboarding smoother for developers. If you would be interested, you will need to create a private support ticket through the Dashboard to request its creation with the necessary details listed in the documentation (Scopes, Redirect URIs, etc.). Once we get the ticket, we will work on getting it set up and sharing the necessary credentials safely with you there.


Forum|alt.badge.img
  • Author
  • New Member
  • October 23, 2026

Thanks Wes, really appreciate it! Yes, I'm interested. Right now developers paste a webhook URL and secret by hand, and a v2 secret key to import history. With OAuth they could click "Connect RevenueCat", approve read-only access to customers and purchases plus permission to add the webhook, and be done. I'll open the support ticket from the dashboard with the details.


Forum|alt.badge.img
  • Author
  • New Member
  • October 23, 2026

Quick update: I've opened the support ticket from the dashboard (Help center > Contact Support) with the OAuth client details: scopes, redirect URIs and client type. Thanks again for pointing me to it, Wes!


wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • October 23, 2026

You’re welcome! Just following up here - I found your support ticket and just responded with the OAuth credentials for you. We can continue this conversation there!


Forum|alt.badge.img
  • Author
  • New Member
  • October 23, 2026

Thanks again, Wes, and thanks to the team for setting up the OAuth client so quickly (ticket 87787). It's live: FiscaLLM now has a "Connect RevenueCat" button. After approval it creates its webhook in the chosen project and imports past subscribers through API v2, so there's nothing to copy or paste. Customer data access is read-only, tokens are stored encrypted and refreshed before they expire, and Disconnect removes the webhook.

Docs: https://fiscallm.com/docs#revenuecat
 


wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • October 23, 2026

You’re welcome! Just followed up in our private support ticket as well. Glad that the process of me setting up your OAuth client and you integrating it went so smoothly. Thank you again for choosing to build an integration directly with RevenueCat.