> ## Documentation Index
> Fetch the complete documentation index at: https://supastack.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For the full documentation corpus in one file, fetch: https://supastack.dev/llms-full.txt

# Usage-based billing and credits for an AI SaaS

Choose prepaid credits, Stripe meters, or seats with included AI usage, then handle retries and failed payments without losing track of what customers used.

_Published 2026-11-27._
_Updated 2026-11-27._

> **Should my AI SaaS charge for credits, meter usage, or bundle usage with seats?**
> It depends on whether the buyer wants a spending ceiling or room to grow. Prepaid credits put a hard limit on consumption. Metered billing works when customers are comfortable paying an invoice after usage. Seats with an included workspace allowance work well when collaboration is the product and AI is one feature. Whichever you choose, record usage in your own database and make billing retries safe.

## Pick a billing model customers can predict

Use prepaid credits if a customer needs to know the most they can spend. Use metered billing if stopping halfway through a job would be worse than an overage on the invoice. If a company is buying a collaborative workspace with an AI feature in it, charge for seats and include an allowance that the team shares. Make the overage policy explicit before they hit the limit.

Sell a unit the customer understands. If every transcription minute does roughly the same work, minutes are better than a made-up currency. If one operation generates a short reply and another reviews a hundred pages, a credit schedule may be easier to understand than tokens. Show the expected debit before they start a costly run.


## Price the job that costs you money, not the average reply

Suppose your $30 plan includes 100 document reviews. At a provider cost of eight cents per review, the allowance costs you $8 when fully used. Let a customer choose a model that costs 60 cents for the same job and that same plan can run up $60 in model charges. That excludes storage, retries, and support.

Measure actual input and output use by model and store the pricing version you used to value it. Set limits on input size and output length before the provider call. For predictable spending, you can publish different credit prices by model rather than silently changing how many jobs a credit buys.


## A Stripe meter counts usage; your ledger explains it

For postpaid billing, define a Stripe meter for the billable unit and attach it to a metered subscription price. Report usage with a stable event identifier and retain the source records locally so you can answer a billing dispute. [Stripe billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits) can offset eligible metered subscription items on invoices. They are not, on their own, an authorization check for whether to start a model call.

For prepaid credits, keep append-only movements for grants, debits, refunds, and expiry. Use a transaction to update the balance and insert the movement together. For variable-cost work, reserve enough to start and reconcile to actual use; document what happens if a provider accepts the request but you lose the response. Do not blindly refund it and submit the same potentially billable work again.


## Plan for failed invoices before sending one

Use the paid webhook, not the success page, to grant purchased credits. Deduplicate the grant using the purchase reference so replaying a provider event cannot increase the balance. For metered usage, store the event being sent before reporting it and replay that exact event if the response is lost. The [billing webhook article](https://supastack.dev/blog/idempotent-billing-webhooks.md) covers what happens when events arrive twice or in the wrong order.

Decide whether a late payment starts a grace period or blocks new paid work immediately. Keep the billing and recovery screens accessible and preserve prior work. Tell the account owner what will stop and when. A retry that eventually pays the invoice should restore the right entitlement, not open a second paid subscription.


## What supastack already tracks

Supastack has a workspace credit balance and an append-only transaction ledger. Its database implementation updates both atomically and supports reference-keyed idempotency. Separately, its usage-reporting job sends usage deltas for configured Stripe meters on eligible subscriptions. It retains a pending report when a send has to be retried. Decide how your product prices and sells credits instead of assuming the ledger is a Stripe customer balance.

The kit also supports workspace bring-your-own-key policies. BYOK puts model charges on the customer's provider account, but you still need access controls and limits for your own infrastructure. See [AI configuration](https://supastack.dev/docs/modules/ai-configuration.md) for the two key modes and the [production AI architecture article](https://supastack.dev/blog/production-ai-saas-architecture.md) for budgets and provider failover.
