azyware
Technology

Usage metering and AI billing for SaaS

EZ
Eazyware
· 7 min read
Quick answer

How does SaaS usage metering work, and how do you bill for AI features with it?

Meter events per tenant, aggregate to billing periods and expose usage in the admin so AI and API features can be priced. The pipeline is small and boring: an immutable event log, idempotent ingestion, periodic aggregation and a reconciliation job that proves the invoice matches the events before it goes out.

SaaS usage metering is the system that records what each tenant consumed, turns those records into billable quantities per period, and shows the running total to the customer before the invoice arrives. It matters more now than it did five years ago because AI features carry a real marginal cost per call, and a flat seat price either loses money on heavy users or overcharges light ones. This article describes the metering pipeline we build inside SaaS development engagements, the pricing models it supports, how it connects to Stripe or Razorpay, and the reconciliation discipline that keeps finance and engineering trusting the same number.

What usage metering is and why AI forces the question

A meter is a named quantity you agree to count: API calls, documents processed, messages sent, tokens consumed, minutes of voice. Metering is the pipeline that counts it reliably per tenant. Billing is the separate step that prices the count. Keeping the two apart is the first design decision, because pricing changes often and counting should not.

AI features make metering unavoidable. Each generation costs money in inference, and the cost varies by model, prompt length and output length. Without a meter you cannot see which tenants are profitable, cannot set fair limits, and cannot answer the question in how to price an AI feature in your SaaS product with anything but a guess. With a meter, pricing becomes a decision you can revisit monthly with data.

Pricing models the meter must support

ModelWhat is countedWhere it fitsMetering requirement
Included allowance plus overageUnits above the plan's monthly quotaMost AI features inside a seat-priced productPer-tenant running total against the quota, with alerts
CreditsPrepaid units drawn down per action, weighted by costProducts with several AI actions of different costWeighted decrement, balance visible in the app
Pure usageEvery unit billed at a rate, often tieredAPIs and developer platformsExact counts, idempotent, auditable per invoice
Outcome-basedSuccessful results only, such as resolved conversationsSupport agents and automation productsMeter tied to a verified outcome event, with disputes handled
Hybrid seats plus usageSeats for people, units for machinesCopilots used by teamsTwo meters reconciled on one invoice

The event log: count once, keep forever

Every billable action emits a usage event: tenant, meter, quantity, timestamp, a unique idempotency key and enough context to explain it later, such as the feature and the model used. Events are appended to an immutable store and never edited. Corrections are new events with negative quantities and a reason. This is what lets you answer a customer's dispute six months later with the exact records.

Idempotency is the part teams get wrong. Retries, duplicated queue messages and client re-sends will produce the same event twice. The idempotency key, usually derived from the request that caused the action, lets the ingestion layer drop duplicates without a lookup race. Test this deliberately by replaying a day of traffic and confirming the totals do not change.

Metering AI calls specifically

For LLM features, record input and output tokens, model and provider on every event, even if the customer is billed in simpler units. The internal cost per tenant then falls out of the same log, and model routing decisions can be checked against margin rather than intuition. The approach in multi-model routing depends on this data existing.

Aggregation: from events to a billable quantity

A scheduled job rolls events up into per-tenant, per-meter totals for the billing period, typically hourly for the running view and once at period close for the invoice. Store the aggregates separately from the events and keep the job idempotent so it can be re-run for a period without double counting. Period boundaries follow the tenant's billing anchor and time zone, not the server's.

Late events are inevitable: a voice call that ends after midnight, a batch job that reports on completion. Decide the grace window, apply late events to the correct period if it has not been invoiced, and to the next period with a note if it has. Write this rule down; it is the first thing finance will ask.

Exposing usage in the admin

Customers accept usage billing when they can see it. The tenant admin should show each meter's running total, the allowance, a projection to period end and a history by day. Alerts at agreed thresholds go to the account owner by email or in-app, and hard limits, where the plan has them, should degrade gracefully with a clear message rather than a failed request. Your own operations team needs the same view across all tenants, sorted by margin, which is where unprofitable accounts and abusive usage first appear.

Connecting to the billing provider

Stripe supports metered prices through usage records or its billing meters, and the Stripe billing documentation is the primary reference for the current API. Razorpay serves Indian tenants invoicing in INR with GST. In both cases the pattern is the same: your aggregation job is the source of truth, and at period close it pushes the final quantity per meter to the provider, which prices it and raises the invoice.

Do not let the provider be the meter. Providers count what you send them and cannot explain a number to a customer. Push totals, keep events, and store the provider's invoice identifier against your aggregate so the two can be joined. The INR and GST specifics are covered in subscription billing for SaaS in India.

Reconciliation: the job that earns trust

Before any invoice is sent, a reconciliation job recomputes the period from raw events and compares it to the stored aggregate and to the quantity pushed to the provider. Any difference blocks the invoice and raises a ticket. Monthly, finance receives a report of billed units per tenant against the internal cost of serving them. This one job is the difference between a metering system that the business relies on and one it quietly works around in spreadsheets.

A worked example

A document-processing SaaS sold seats and added an AI extraction feature. Usage varied enormously between customers: some processed a few files a week, others thousands a day. Inference cost for the heaviest tenants exceeded their subscription, and the team had no per-tenant view of it.

The metering build added a usage event on every extraction with page count, model and tokens. An hourly aggregate fed a usage panel in the tenant admin, showing pages against the plan allowance with a projection. Pricing moved to an included allowance with overage, and existing contracts were mapped to custom allowances so nobody's invoice changed at launch. Stripe billed USD customers and Razorpay billed Indian ones from the same aggregate, with a reconciliation job gating both. Within the first quarter the operations view had identified the accounts to move to a higher tier and the accounts whose model routing needed to change. The pattern resembles the extraction pipeline in the KYC document intelligence case study, where per-document cost visibility was equally important.

Team and timeline

A metering and billing build is a backend lead, one backend engineer, a front-end engineer for the admin panels and a part-time analyst who owns the reconciliation report with finance. Your side provides the meter definitions, the pricing decision and the existing contracts to map.

Adding metering to an existing product typically takes four to six weeks under SaaS development, from $31,500 (₹20.8L), or as an API and integrations engagement from $7,000 (₹4.4L) when the product already has an event pipeline and only the billing connection is missing. New products get metering built in from the start inside a Launch 6 at $26,500–45,500. The reconciliation job and admin panels are maintained under a Care Plan; tiers are on the pricing page.

Before you start: a checklist

  • Name each meter and the exact event that increments it
  • Decide the pricing model per meter and map every existing contract to it
  • Define the idempotency key for each event source and test replay
  • Set the billing anchor, time zone and late-event grace rule per tenant
  • Design the tenant usage panel with allowance, projection and alerts
  • Choose the billing provider per currency and confirm GST handling for INR
  • Write the reconciliation job before the first real invoice
  • Agree who in finance reviews the monthly units-versus-cost report

Questions clients ask

  • Should we bill by tokens? Rarely. Bill in units customers understand, such as documents or conversations, and record tokens internally for cost.
  • What if a customer disputes an invoice? The immutable event log lets you show every counted action; corrections are negative events with a reason.
  • Can we change prices later? Yes, because pricing is separate from counting. New rates apply from a period boundary; the meter does not change.
  • How do we stop runaway usage? Threshold alerts and soft or hard limits per plan, enforced at the point the event is created.

Continue with LLM inference costs: how to forecast your monthly bill, multi-tenant SaaS architecture for the tenancy the meter depends on, and the SaaS copilot service for the features most often metered.

Count once, keep the events, price separately and reconcile before every invoice; that is all metering has to do, and it has to do it every time.

Frequently asked questions

What is the difference between metering and billing?

▾

Metering counts what each tenant used, reliably and auditably. Billing prices the count. Keeping them separate lets you change prices without touching the counting pipeline and lets you explain any invoice from raw events.

Can Stripe meter usage on its own?

▾

Stripe can price quantities you send it, but it cannot explain those quantities to a customer or reconcile them. Keep your own event log as the source of truth and push period totals to Stripe at close.

How should an AI feature be priced inside a seat-based SaaS?

▾

Usually as an included monthly allowance with overage, or as credits weighted by the cost of each action. Both need a per-tenant meter and a usage panel so customers see the total before the invoice.