Combining Seats, Usage, and AI Tokens
One policy. Multiple meters. Real-world pricing.
Modern products rarely price on a single dimension.
A typical AI product might include:
Seats (per org)
Usage (storage, bandwidth, compute)
Model tokens (per-user or per-API key)
Limitr lets you express all of these in a single policy, while tracking and enforcing them at the correct scope.
The Core Idea
Plans describe entitlements. Entitlements define limits. Meters track usage. Customers own state.
Each dimension can:
use its own unit
reset independently
apply to different customers
emit its own events
All without branching logic in application code.
The Policy
This policy defines:
seat limits per org
daily usage limits
per-model token caps
free vs pro plans
Customers and Scope
In this example:
Seats are tracked per organization
Usage and tokens are tracked per user
Users can have alternate IDs (Stripe customer, API key, etc.)
Seat Enforcement (Org-Level)
What’s happening:
Seats are enforced on the org customer
Any user tied to the org consumes from the same meter
Limitr prevents exceeding the plan limit
AI Token Enforcement (User-Level)
Key detail:
Each model has its own entitlement
Tokens are tracked independently
Limits are enforced deterministically
Usage Enforcement with Units
Units are parsed automatically
Internal state is normalized (MB)
Limits are enforced consistently
Plan Changes Without Redeploy
Changing the plan immediately affects enforcement — no code changes, no redeploy. Alternatively, just change the plan field in the customer (if referencing a remote customer record).
Persisting State
All customer state (meters, balances, resets, plans) can be:
serialized
stored in a database
synced across systems
Why This Matters
This single policy replaces:
limits.tsusage.tstokens.tsad-hoc plan checks
fragile billing conditionals
Limitr becomes the source of truth for monetization enforcement.
Mental Model
Your app asks: “Can I do this?” Limitr answers: “Yes, no, or record an overage — and here’s why.”
Complete Example Code
Getting Started
Define your credits for tokens and entitlements for each plan
Attach customers (users/orgs/api keys) to plans
Increment meters as API calls happen
Listen for events to handle overages or billing
Limitr lets you start simple (free vs pro) and scale up to complex AI pricing without touching your application code.
Star the GitHub repo, create a bug/ticket, reach out on Discord, and get involved.
I use Limitr with Stripe, so if you want more details on this, let me know ([email protected]).
Last updated
Was this helpful?