Skip to main content
AI Backend GlossaryGlossary

Usage Metering

Tracking per-customer API consumption for usage-based billing.

Definition

Usage metering is the practice of measuring how much of a service a customer consumes — API calls, tokens, compute time, or any unit — and recording it for billing. In AI products, metering usually tracks LLM token consumption (input + output tokens) per customer or API key.

Why it matters for AI APIs

Usage-based pricing is the preferred model for AI APIs. Customers pay for what they use, reducing barrier to entry. But implementing metering requires per-request instrumentation, batching, and integration with a billing provider like Stripe — infrastructure that takes days to build correctly.

In FastAPI AI Kit

Every metered endpoint in the kit automatically calls `meter.record(key_id, tokens)` after each LLM call. The meter batches these records and reports to Stripe's metered billing API. Token counts from OpenAI and Anthropic are normalized to a single unit.

Related terms