— Infrastructure

Usage-based billing for AI SaaS: make every charge explainable

Design AI SaaS usage billing with stable event IDs, explicit billable units and a reconciliation ledger. Explain charges before customers question them.

3 min readUpdated 2026-10-30By AptixLabs studio
Explain every charge. Diagram: Product outcome — Completed task; Usage event — Stable identity; Price version — Agreed unit; Invoice check — Reconciled totalAptixLabs · 2026-10-30

Original AptixLabs workflow diagram; a planning model, not measured product results.

Usage-based billing works only when a customer can connect a charge to an understandable unit of value. “AI credits” without a definition make budgeting difficult and disputes expensive. Before choosing a billing provider, decide which product event is billable, when it becomes final and how a correction reaches the customer.

Define the unit before building the meter

Provider tokens, completed documents and successful workflow runs are different units. Your internal cost may be token-based while your customer-facing unit is a completed task. Write a contract for that unit: what qualifies, what is excluded, how retries behave and which pricing version applies. A failed model call should not silently count as a completed customer outcome.

The right unit depends on what customers buy and can verify. If task complexity varies substantially, a flat per-task price may expose you to unpredictable costs. Conversely, passing every provider detail through to a buyer can make the product difficult to budget. Model both the customer explanation and your delivery cost before choosing.

Keep a product usage ledger

In a hypothetical document-review product, one accepted review produces a stable usage event. Retries reuse that identity. The ledger records the workspace, unit, quantity, occurrence time, completion state and pricing version. Store enough provenance to investigate a charge without copying sensitive document contents into billing logs.

Illustrative usage-to-invoice trace
StageRecordQuestion it answers
Product outcomeReview R-104 completedDid the agreed billable task happen?
Usage eventEvent U-104, quantity 1Was it counted once?
RatingPricing version P-3Which commercial rule applied?
Billing exportProvider acknowledgementWas accepted usage delivered?
ReconciliationInvoice period and adjustmentDoes the charge match the ledger?

This is an architecture example, not a claim about an existing AptixLabs billing deployment. Keep usage identity distinct from delivery-attempt identity: a failed network request can require a retry without creating a second billable task. Decide how late events, cancellations and corrections affect closed periods.

Choose the billing integration against current requirements

Stripe's current documentation distinguishes basic meter-event ingestion from its broader Metronome offering. Product names and recommended paths can change, so review the current integration documentation during scoping. Requirements such as contract pricing, credits, corrections and customer-visible usage should guide the choice rather than an old tutorial's endpoint.

Reference: Stripe's current usage-recording documentation

Test the invoice, not just the webhook

Replay a duplicate event, deliver an event late, interrupt the export and correct a previously counted task. Then compare the ledger, the provider's accepted usage and a test invoice. Define who investigates mismatches and how the customer sees an adjustment. These tests complement webhook idempotency; they do not replace it.

Related: idempotent subscription webhook processing

Budget notifications and hard spending limits also need separate definitions. A notification can arrive after additional usage; it is not automatically a spending cap. If you promise a cap, enforce it where work is admitted and decide how concurrent jobs reserve or release allowance.

Bring a charge example to discovery

For a SaaS billing engagement, show one sample customer action, the proposed charge and the expensive failure case. AptixLabs can help map that path into an event contract, integration scope and reconciliation checklist. A clear explanation of one charge is a better starting point than implementing a flexible meter with no agreed commercial meaning.

Should an AI SaaS product charge per token or per completed task?

Choose a unit buyers can understand and your system can verify, then model its delivery cost. Tokens and completed tasks have different budgeting and margin trade-offs; neither is universally correct.

How do we avoid duplicate usage charges?

Give each billable product event a stable identity, make delivery retries idempotent and reconcile accepted provider usage against the product ledger and invoice. Test corrections and late events too.

Need help with b2b saas development for connected customer workflows?

Tell us about your product, existing stack and the problem you need to solve. We can discuss integration scope, implementation tradeoffs and a practical first milestone.

Start a conversation