Pricing models
Recipes for credits and top ups, trials, subscriptions, pay as you go, seats, hybrids, rollovers and custom deals.
Every model below is configuration. Your app code stays the same: check, track, attach.
Credits and top ups
One balance that several features spend from.
- Create metered features
basic_messageandpremium_message. - Create a credit system
creditswithcredit_schema1 for basic and 10 for premium. - Plan
pro: USD 20.00 a month withcreditsincluded 2,000, resetting monthly. - Plan
top_up: intervalone_off, itemcreditswithusage_model: "prepaid", USD 1.00 per 100 credits (billing_units: 100), no reset.
await revenue.check({ customerId, featureId: "premium_message" });
await revenue.track({ customerId, featureId: "premium_message", value: 1 });
await revenue.attach({ customerId, planId: "top_up", featureQuantities: [{ featureId: "credits", quantity: 500 }] });Checks and tracks name the underlying feature; Revenue spends the credits. Top ups stack and never reset, and the monthly grant is used first. Add an auto top up to refill without asking.
AI credits priced by tokens
Give the credit system credit_value_usd: 0.01 and markup: 0.3, then report tokens:
await revenue.balances.trackTokens({ customerId, modelId: "anthropic/claude-haiku-4-5", inputTokens: 1200, outputTokens: 400 });Revenue prices the tokens, adds 30 percent, spends credits and records the real provider cost, so the margin view shows exactly what you kept. Use locks when you need to reserve before a long completion.
Free trials
trial_days: 14 on a paid plan. With trial_card_required: false the trial starts on attach with no checkout and ends unless they pay. With true the card is checked first, and the plan bills automatically when the trial ends. One trial per customer per plan, and per device when you send fingerprint.
Subscriptions with tiers
Plans in one group replace each other: free, pro, business. Upgrades are immediate and prorated; downgrades wait for the end of the period. Annual pricing is a separate plan in the same group, such as pro_annual at interval: "year".
Pay as you go
An item with usage_model: "usage_based", included: 1000, USD 1.00 per 1,000 calls. Customers keep going past 1,000; the balance goes below zero and the extra is on the next renewal invoice. Cap it with max_purchase on the plan or a spend limit per customer. For volume discounts use tiers with tier_behavior: "graduated" or "volume".
A plan with no base price and only pay as you go items asks for a card on attach, so usage can be billed later.
Seats
A metered feature seats with consumable: false. Either:
- Prepaid seats: item
usage_model: "prepaid", USD 10.00 per seat. Buy withfeature_quantitiesonattach; add more withbilling.update(charged now for the days left) or fewer (from renewal). - Seats as they are used: item
usage_model: "usage_based",included: 3, USD 5.00 per extra seat,proration: "prorate_immediately". Create an entity per member withfeature_id: "seats"; the fourth seat is charged for the days left, and renewals bill every seat past three.
Per seat allowances
Attach a plan to each entity (billing.attach with entity_id) to give every member their own 50 credits a month, while the company keeps a shared pool on the customer. Checks with entity_id use the member's balance first.
Hybrid
Mix the above in one plan: a base price, included credits that roll over, pay as you go API calls, seats with included members, and an on and off feature like SSO.
Rollovers and expiring grants
rollover: { "max": 500, "duration_cycles": 2 } on an item carries up to 500 unused units into the next two periods. balances.create with expires_at gives grants that vanish on a date. Revenue always spends resetting grants first, then the ones expiring soonest.
Custom deals
Pass customize to attach for one customer: a different price, more included units, a different overage price. The deal stays on their subscription through renewals and plan versions.
Changing prices later
Edit the plan. If it has customers, Revenue saves a new version: new customers get it, current customers keep their version and price. Move them when you are ready with plans.migrate or the Move them button on the plan.