AIPricingLabQ&A
Q&A

How do I track image generation usage per user?

Call vevee.reserve(userId, "image.render", 1, { model: "flux-pro" }) before calling the image provider; commit on success, release on error. AIPricingLab counts each render against any matching limit groups (total renders, premium renders, cents budget).

Last updated: 2026-05-10

Same pattern, any provider

AIPricingLab does not care if you call Flux, DALL·E, SDXL, or Midjourney. The event is whatever you decide it is. Tag it with metadata for analytics splits.

const r = await vevee.reserve(userId, "image.render", 1, {
  model: "flux-pro",
  variant: "4k",
});
if (!r.allowed) return { error: "limit" };
try {
  const image = await callFluxPro(prompt);
  await vevee.commit(r.reservationId!);
  return { image };
} catch (e) {
  await vevee.release(r.reservationId!);
  throw e;
}

Mixed quotas: total + premium

Define total_renders (no metadata filter) and premium_renders (filter: model = flux-pro). One render hits both groups. Free plan: 20 total, 0 premium. Pro plan: 500 total, 50 premium.

Related questions