Usage-based billing with Stripe for AI features
How to charge for AI usage with Stripe: Meters or Metronome, pricing models for tokens and credits, sending usage events safely, and keeping limits in your app.
Leer en español →
To bill for AI usage with Stripe, you record how much each customer uses (tokens, generations, minutes), send that usage to Stripe as meter events, and attach a metered price to the customer's subscription so Stripe charges for it at the end of each billing period. In 2026 there are two Stripe products for this: the Meters API, now called basic usage-based billing, and Metronome, which Stripe now owns and recommends for new integrations that need real-time credits or complex contracts. Either way, your app still has to count usage itself and enforce limits before calling the model.
This guide helps you pick between the two, choose a pricing model, send usage reliably and avoid the gaps that let a customer run up a bill nobody planned for.
Meters or Metronome: which should you use?
Stripe's documentation now describes Metronome as its primary usage-based billing platform and the recommended starting point for new integrations. Basic usage-based billing on the Meters API remains fully supported, and it has better compatibility with other Stripe products.
| Basic usage-based billing (Meters) | Metronome | |
|---|---|---|
| Pay-as-you-go, flat fee plus overage | Yes | Yes |
| Credits | Yes, reconciled at invoice time | Yes, real-time burndown |
| Prepaid credit packs with live balance | No | Yes |
| Different rates per model or token type on one meter | No | Yes (dimensional pricing) |
| Works with Checkout, Connect, Stripe Dashboard | Yes | Limited or not supported |
| Billing for LLM tokens with synced model prices | No | Yes, in public preview |
A practical rule: if you sell a monthly plan through Checkout with an overage charge, Meters is simpler and fits the rest of your Stripe setup. If you sell prepaid AI credits that customers spend down in real time, or you need different rates per model, Metronome is built for that. Metronome's token billing feature, in public preview, keeps token prices for OpenAI, Anthropic and Google models in sync for you.
The rest of this guide uses Meters, because that is where most small apps start.
Which pricing model fits an AI feature?
| Model | How it charges | Good when |
|---|---|---|
| Pay-as-you-go | Per unit used, billed at period end | Usage varies a lot between customers |
| Flat fee plus overage | Monthly fee includes an allowance; extra usage is metered | You want predictable revenue and fair heavy-use pricing |
| Credits | Customers get or buy a balance and usage draws it down | You want one "AI credit" unit across several features |
| Tiers | Per-unit price drops at higher volumes | You want to reward large customers |
Whatever you pick, price in a unit customers understand. "1,000 credits" or "100 generations" is easier to read on an invoice than raw tokens, and it lets you change models later without repricing.
How do you set it up with Meters?
- Create a meter. On the Meters page in the Dashboard, or through the API. Give it an event name such as
ai_tokensand an aggregation: Sum (add up the values), Count (count the events) or Last (use the most recent value). - Create a metered price for your product that uses that meter, with the unit price or tiers you chose.
- Add it to the subscription, either as the only price or next to your flat monthly price.
- Send meter events from your server each time usage happens, or in batches.
A meter event is a small request:
curl https://api.stripe.com/v1/billing/meter_events \
-u "$STRIPE_SECRET_KEY:" \
-d event_name=ai_tokens \
-d "payload[value]=1840" \
-d "payload[stripe_customer_id]=cus_123" \
-d identifier=gen_8f2c1
By default the meter reads the customer from stripe_customer_id and the amount from value; you can rename both keys when creating the meter.
How do you send usage without double-billing or losing it?
Most billing bugs here are about events, not prices.
- Always set an
identifier, such as the ID of the generation in your database. Stripe uses it to recognise the same event sent twice, for example after a network retry. - Mind the time window. Event timestamps must be within the past 35 calendar days and no more than 5 minutes in the future. Usage that arrives after the period's invoice is finalised isn't added to that invoice or the next one, so report before the period closes.
- Fix mistakes quickly. You can cancel an event with a meter event adjustment, but only for events sent within the last 24 hours.
- Batch heavy traffic. In live mode the meter event endpoint allows 1,000 calls per second per account, with one concurrent call per customer per meter. Summing usage per customer every minute is usually enough. For far higher volumes Stripe offers meter event streams in API v2.
- Expect a delay. Stripe processes meter events asynchronously, so totals on upcoming invoices can lag behind.
Why must your app still enforce limits itself?
Stripe meters usage to bill it; it doesn't stop a request. With basic credits, Stripe reconciles at invoice time and its docs note that customers can exceed their balance during the cycle. So:
- Keep a usage ledger in your own database, written in the same step that calls the model.
- Before each AI call, check the customer's remaining allowance and block or warn when it runs out.
- Set a hard ceiling per customer per day, even on pay-as-you-go plans, so a bug or a script can't create a huge invoice.
Stripe can also send usage alerts when a customer crosses a threshold, which is a useful second layer. Our guides on limiting features by plan and controlling AI API costs cover the app side in more detail.
How do you show customers what they've used?
People accept usage bills they can predict. Show current usage and the estimated charge in your app, from your own ledger, since it is real-time and Stripe's totals may lag. Send an email at 80% and 100% of any included allowance. Put the unit and rate on your pricing page in plain words.
Quick answers
Can I use Checkout to sell a metered plan? Yes, with basic usage-based billing. Metronome's Checkout support needs custom API calls and webhooks.
Do I have to migrate my existing Meters setup to Metronome? No. Stripe says existing Meters integrations don't need to migrate.
Should I send one event per AI request? You can, within the rate limits, but sending one summed event per customer per minute or hour is cheaper and easier to retry.
How do I test it? In a sandbox, subscribe a test customer to the metered price, send events, and advance a test clock past the period end to see the invoice. Our subscriptions guide covers test clocks.
Pricing an AI feature and not sure how to bill it?
Getting the meter, the ledger and the limits to agree is most of the work. Our Stripe payments service and AI development service can set up both sides. You can also run the free app health check, read Stripe's usage-based billing docs, or tell us about your pricing.


