In-depth guides for AI usage metering and pricing
Tutorials with full code. Implement per-user OpenAI tracking, atomic rate limits, freemium image generators, token-based pricing, and the reserve / commit / release pattern that keeps it all correct under load.
Each guide below is a complete walkthrough - code, schema, and reasoning - written for developers shipping AI products in production. If you find a missing topic, send a note to hello@vevee.org.
How to track OpenAI API usage by user (with quotas, in real time)
Step-by-step guide to tracking OpenAI API usage per end-user with real-time quotas. Pure-TypeScript pattern using @vevee/sdk. Concurrency-safe, provider-agnostic, ten-minute integration.
7 min · GuideHow to implement per-user rate limits in your AI app
Per-user rate limits for AI apps need atomic enforcement, plan awareness, and refundable reservations. Here is the pattern that works under load - using @vevee/sdk and ~30 lines of code.
9 min · GuideHow to implement usage-based pricing for an AI product
Decide between per-token, per-action, and hybrid pricing. Implement quotas, refunds, and Stripe meter sync. Step-by-step with code, from a developer who has shipped all three models.
6 min · GuideThe reserve / commit / release pattern: atomic AI quota enforcement
Why naive AI usage metering breaks under concurrency, and the only correct pattern that fixes it. Reserve / commit / release explained, with full TypeScript example and the failure modes it prevents.
8 min · GuideHow to charge AI app users by token usage (with refunds and live balance)
Step-by-step: charge users for actual token consumption with pre-paid credits, post-paid invoicing, and a live balance display. Atomic reservations, accurate refunds, and Stripe meter sync.
10 min · GuideBuild a freemium image generator: end-to-end tutorial
Ship a freemium AI image generator with hard caps, upgrade prompts, real-time analytics, and a live "renders left" badge - using @vevee/sdk + your image provider of choice. Full code, ten-minute build.
Looking for shorter answers?
See the Q&A for one-page answers to specific questions, or the glossary for term definitions. For pattern overviews see the use cases.