Lago has been able to follow the pace of our releases and has allowed us to focus on what we do best.

Usage Metering
Lago is open-source usage metering and metered billing software that gives engineering and finance full control over any usage-based model. Event-driven metering, hybrid pricing, self-hosted or cloud.
Capture usage from every source that drives your product, from HTTP APIs and streaming connectors to AI gateways and the LLMs behind them. Lago brings events from Kafka, Kinesis, S3, GCP, Redis, Azure, and more into one real-time metering flow. Track credit drawdown as it happens, apply usage-based pricing at scale, and keep every charge visible from the first event to the final invoice.
AI gateways & LLMs
API & streaming
Ready for billing
Send events from your application with the API or a Lago SDK.
Aggregate events into billable metrics, from API calls to compute hours.
Combine usage charges, subscriptions, and prepaid credits in your plans.
Apply each customer’s plan to their usage and generate their invoice.
Bring usage from HTTP APIs, event streams, and LLM gateways into Lago. Connect sources such as Kafka, Kinesis, and your AI stack to ingest usage at scale and turn it into billable metrics.

Lago ingests raw usage data and converts it into charges. Aggregate events in real time to ensure your billing doesn’t miss a beat.

Use REST batch or Kafka/Redpanda for different event volumes. Validate throughput and invoice accuracy with your workload.

Both non-engineers and engineers can update usage charges via API or Lago’s no-code UI.

Everything you need to bill for usage.


Billing is mission-critical. Lago is engineered for the realities of high-volume enterprises.
See how ambitious teams build and scale their billing with Lago.
Lago has been able to follow the pace of our releases and has allowed us to focus on what we do best.

Usage metering captures product consumption, an API call, a token, a compute-minute, as an event, then aggregates those events into a number billing can charge for. In Lago, every event carries a code that maps to a billable metric, a transaction_id for deduplication, and a subscription reference, and events arrive through the REST API, batch API, streaming connectors, or an S3 backfill.
Lago matches each event to a billable metric and a customer, assigns it to the right billing period by its own timestamp, and runs the metric's aggregation formula once the period closes. The result gets multiplied by the plan's pricing rules to produce the invoice line item. Teams can also send a precomputed amount directly, bypassing Lago's aggregation when needed.
Lago supports seven: COUNT, COUNT UNIQUE, LATEST, MAX, SUM, WEIGHTED SUM, and CUSTOM. COUNT tallies event frequency (API calls, notifications). COUNT UNIQUE and LATEST track distinct or most-recent property values (active seats, current storage). MAX and SUM read a numeric property directly for peak or cumulative usage. WEIGHTED SUM prorates a value by time in effect, so partial-month or mid-cycle usage bills accurately.
Lago's ingestion pipeline is built to handle high-throughput usage metering at scale. Teams typically start on single-event REST calls, move to the batch API as volume grows, and adopt a streaming connector (Kafka, Redpanda, Amazon Kinesis) once they're metering at very high event rates. Historical backfills run through S3 as newline-delimited JSON instead of the live API.
Lago assigns each event to its billing period using the event's own timestamp, not its arrival time, so a late event still lands in the correct invoice. If that invoice is already finalized, a late event for a recurring charge rolls into the next cycle instead of reopening a closed one. Events outside a subscription's active window are ingested but excluded from any charge.
Lago deduplicates on transaction_id, so a retried or duplicated event never gets billed twice. This makes it safe to build a metering pipeline with automatic retries: sending the same event again simply gets recognized and dropped rather than double-counted.
Yes. Lago supports hybrid plans that combine a flat subscription fee with usage-based charges, alongside prepaid credits and usage allowances, all on the same billable-metric engine. A company can offer a fixed-price base tier and meter overage (extra API calls, seats, or compute) on top, in one billing system.
Both. Lago ships as a cloud deployment and a self-hosted deployment, and billable metrics and usage ingestion are core to each. An open-source version is also available for teams that want to run metering entirely on their own infrastructure, which matters for compliance or data-residency requirements.
Metering is the measurement layer: capturing and aggregating raw consumption into a countable number. Usage-based billing is what happens next: applying a price and a plan's rules to that number to produce an invoice. A billable metric defines how usage is measured; a plan's charge configuration defines how it's priced.
Create a billable metric, choose the aggregation type that matches how the product is consumed, and send one test event through the REST API with a transaction_id and subscription reference. Retrieving that event back confirms Lago parsed it correctly before wiring up a production pipeline.