How do I implement freemium for an AI product?
Define two plans (free, pro) with different limit groups. Assign free on signup. Gate AI calls with reserve / commit / release. On limit_reached, show an upgrade prompt. On Stripe checkout success, switch the user to pro via vevee.upsertSubscription.
Last updated: 2026-05-10
Two plans, two limit groups
In the dashboard: plan_free with image.render quota of 20/month; plan_pro with quota 500/month. Match rule on both: event_type = "image.render". Same code path, different quotas.
On signup, assign the free plan
Idempotent - safe to call on every login.
await vevee.upsertSubscription({
userId: user.id,
planId: "plan_free",
});Gate AI calls and catch limit_reached
When a free user hits 20 renders, the next reserve returns allowed=false. Render an upgrade modal in your UI.
On Stripe checkout, upgrade them
Switch them to plan_pro from your Stripe webhook handler. Counters keep ticking; the higher cap unblocks them.
await vevee.upsertSubscription({
userId: internalUserId,
planId: "plan_pro",
});Close the cycling exploit
Use onPlanChange: "block" so users can't free-trial → pro → cancel → free-trial again to keep getting fresh quotas.
Related questions
How do I track LLM usage per user?
Call vevee.track(userId, "llm.tokens", tokenCount) after each LLM call. AIPricingLab counts it against the user's plan limits in real time a…
Q&AHow do I rate-limit OpenAI calls per user?
Use vevee.reserve(userId, "openai.chat", 1) before the OpenAI call. If allowed=false, return 429. If allowed=true, call OpenAI then commit o…
Q&AHow do I add quotas to my AI app?
Define limit groups in the AIPricingLab dashboard with the unit and quota you want, attach them to a plan, assign the plan to each user. Gat…