TEST MODE - use card 4242 4242 4242 4242 (any future date, any CVC). No real money.

Usage-based billing for an AI product, without losing money on heavy users

An AI assistant that charges a flat monthly fee has a hidden problem: every reply costs money to generate, and heavy users can cost more than they pay. MeterDemo meters every reply in Stripe, prices input and output tokens separately so price follows cost, and makes sure no usage goes unbilled.

1. Problem

Flat pricing loses money

On a $49 flat plan, the sample power user costs more in AI usage than they pay, while light users overpay and leave. One token price doesn't fix it either: output tokens cost 5x more than input.

2. Solution

Price follows cost, in Stripe

Two Stripe Billing Meters (input and output tokens), each with a graduated price and a free allowance. Prices are found by lookup key, so pricing can change in Stripe without a code deploy.

3. Safeguard

No unbilled usage

If reporting usage to Stripe fails after a reply, it's retried with the same ID (never double-billed), then recorded for a reconciliation job that compares our records with Stripe's meters.

How a reply becomes an invoice

Customer chats→ AI reply + token counts→ Input & output meters→ Graduated prices→ Monthly invoice→ Card charged, webhook

The live demo: subscribe with the test card in Stripe Checkout, chat, and watch the usage panel and Stripe's invoice preview update. Manage billing opens Stripe's Customer Portal.

Built by Ky Gray with Stripe Billing Meters, Checkout, the Customer Portal, webhooks and test clocks. Everything runs in a Stripe sandbox. Not affiliated with Stripe.