How 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. Gate AI calls with vevee.reserve before the AI provider call.
Last updated: 2026-05-10
Three steps
(1) Create a limit group: unit (count / tokens / seconds / cents), quota (number), period (daily / weekly / monthly / lifetime), match rule (event_type and optional metadata). (2) Attach it to one or more plans. (3) Assign the plan to each user via vevee.upsertSubscription.
Gate AI calls
For hard quotas, wrap AI calls in reserve / commit / release. For soft quotas (count for invoicing only), just track().
const r = await vevee.reserve(userId, "image.render", 1);
if (!r.allowed) throw new LimitError(r.reasons);
try {
const result = await callAi();
await vevee.commit(r.reservationId!);
return result;
} catch (e) {
await vevee.release(r.reservationId!);
throw e;
}Reset frequency
Pick the period that matches your business: daily for anti-abuse, weekly for soft pacing, monthly for plan quotas, lifetime for one-time credit packs.
Related questions
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_rea…
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&AWhat is the reserve / commit / release pattern?
reserve atomically holds quota with a 60-second TTL; commit confirms the reservation after the AI call succeeds; release rolls it back on fa…