Getlago

Usage Metering

Meter usage in real time. Bill it without the headaches.

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.

Lago meters input, output, and cached tokens in real time. Usage events from sources such as OpenAI, Anthropic, Google Gemini, Mistral, Ramp Router, Snowflake Cortex, Databricks, Cloudflare, AWS Kinesis, Amazon S3, Google Cloud, Redis, and Azure stream into one chart showing 1.2 million tokens. An events feed lists each metric as it arrives, at rates between 100 and 50,000 events per second.

Trusted by the most innovative companies

Mistral AI
PayPal
Groq
Synthesia
Laravel
Swan
Epicor
1NCE
Cerebrium
Blacksmith
Lune
OQC

Real-time metering
and usage-based billing
at scale.

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

  • OpenAI
  • Anthropic
  • Google Gemini
  • Mistral
  • AWS Bedrock
  • Ramp Router
  • Snowflake Cortex
  • Databricks
  • Cloudflare
  • More

API & streaming

  • HTTP
  • Kinesis
  • S3
  • Kafka
  • GCP
  • Redis
  • Azure
  • More
Lago
Usage meteringBilling

Ready for billing

  • Invoicing
  • Real-time credit balances
  • Usage reports
  • Taxes
  • Analytics
  • Revenue Recognition
  • Alerts
  • Governance

Capture your usage

Send events from your application with the API or a Lago SDK.

Define what counts

Aggregate events into billable metrics, from API calls to compute hours.

Choose your pricing

Combine usage charges, subscriptions, and prepaid credits in your plans.

Turn usage into invoices

Apply each customer’s plan to their usage and generate their invoice.

Ingest usage at scale from any source

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.

Ingest usage at scale from any source

Turn raw usage data into accurate invoices

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

Turn raw usage data into accurate invoices

Bill usage at scale

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

Bill usage at scale

Adapt pricing on the fly

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

Adapt pricing on the fly

Usage-based billing is easy now

Everything you need to bill for usage.

Define billable metrics.

Define billable metrics. Define metrics you’ll charge for. Charge for them directly, include an allowance or use them for credit consumption.

Ingest usage.

Ingest usage. Charge for credits, tokens, compute hours or API calls. Each event carries a transaction_id, so a retried event is billed once.

Create hybrid plans.

Create hybrid plans. Combine usage-based with subscription models.

Customize with overrides.

Customize with overrides. Customize terms like pricing, usage budgets and more for enterprise customers.

Empower all teams with usage data

Engineers

Engineering

Build billing without the headaches.

Product

Product

Ship complex pricing and new packaging faster.

Finance

Finance

Billing for all motions, products and geographies.

Operations

Operations

One source of truth for all billing data.

Powering fast-growing AI scaleups.And global enterprises.

See how ambitious teams build and scale their billing with Lago.

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

— Timothée Lacroix, CTO, Mistral AI

Timothée Lacroix

Related reading

Metering, usage-based billing and how teams price on consumption.

Usage Metering FAQ

What is usage metering?

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.

How does Lago calculate usage-based charges?

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.

What aggregation types does Lago support?

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.

How much usage volume can Lago's metering engine handle?

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.

How does Lago handle late or backdated usage events?

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.

What happens if a usage event is sent twice?

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.

Can usage-based billing be combined with subscriptions?

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.

Is usage metering available self-hosted or only in Lago Cloud?

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.

How is usage metering different from usage-based billing?

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.

What's the fastest way to get started with usage metering in Lago?

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.

Lago solves complex billing.