Cette page est affichée en anglais. Une traduction française est en cours.
SkillsApr 10, 2026·2 min de lecture

Lago — Open Source Usage-Based Billing API

Lago is an open-source metering and billing engine for usage-based pricing, subscription management, invoicing, and payment orchestration.

Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 29/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
step-1.md
Commande de staging sûr
npx -y tokrepo@latest install f9227c2e-3474-11f1-9bc6-00163e2b0d79 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

TL;DR
Lago handles metering, subscriptions, invoicing, and payment orchestration for usage-based pricing models as an open-source billing API.
§01

What it is

Lago is an open-source billing API designed for usage-based pricing models. It handles event ingestion, metering, subscription management, invoice generation, and payment orchestration. The project is licensed under AGPL-3.0.

Lago targets SaaS companies, API platforms, and AI services that charge based on consumption -- API calls, tokens, compute hours, or storage. It replaces proprietary billing platforms like Stripe Billing, Chargebee, or Zuora for teams that need full control over their billing logic.

§02

How it saves time or tokens

Lago provides a complete billing pipeline out of the box. Instead of building metering, aggregation, proration, and invoice rendering from scratch, you configure billing plans and meters through the dashboard or API. Events are ingested via a simple HTTP endpoint, and Lago handles the rest.

The self-hosted deployment means you avoid per-transaction fees from managed billing platforms, which matters at scale for high-volume usage-based models.

§03

How to use

  1. Clone the repository and start with Docker Compose: git clone https://github.com/getlago/lago.git && cd lago && docker compose up -d.
  2. Open the dashboard at http://localhost:80 and configure your billing plans, meters, and pricing tiers.
  3. Ingest usage events from your application via the REST API and let Lago generate invoices automatically.
§04

Example

# Start Lago
git clone https://github.com/getlago/lago.git
cd lago
docker compose up -d

# Ingest a usage event
curl -X POST http://localhost:3000/api/v1/events \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "event": {
      "transaction_id": "txn_001",
      "external_customer_id": "customer_123",
      "code": "api_calls",
      "timestamp": 1700000000,
      "properties": {"tokens": 1500}
    }
  }'
§05

Related on TokRepo

§06

Common pitfalls

  • Lago uses AGPL-3.0 licensing. If you modify the source and serve it as a SaaS, you must open-source your changes. Review the license before deploying in proprietary environments.
  • The Docker Compose setup requires PostgreSQL and Redis. Ensure both services have adequate resources for production workloads with high event volumes.
  • Invoice PDF generation depends on a separate service. If you need custom invoice templates, you must configure the PDF rendering component separately.

Questions fréquentes

How does Lago compare to Stripe Billing?+

Lago is open-source and self-hostable, giving you full control over billing logic and data. Stripe Billing is a managed service with simpler setup but charges per-transaction fees and limits customization. Lago is better suited for complex usage-based models where you need custom metering rules.

What pricing models does Lago support?+

Lago supports flat-rate subscriptions, usage-based pricing with configurable aggregation (sum, count, max, unique count), tiered pricing, volume pricing, graduated pricing, and percentage-based pricing. You can combine multiple billable metrics in a single plan.

Can Lago handle high-volume event ingestion?+

Yes. Lago uses an event queue backed by Redis for ingestion and processes events asynchronously. For very high volumes, you can scale the worker processes horizontally. The metering engine aggregates events efficiently using PostgreSQL.

Does Lago integrate with payment processors?+

Lago integrates with Stripe, GoCardless, and Adyen for payment collection. It generates invoices and can trigger automatic payment attempts through these processors. You can also use Lago for invoicing only and handle payments separately.

Is there a hosted version of Lago?+

Yes. Lago offers a cloud-hosted version at getlago.com with managed infrastructure, support, and additional enterprise features. The self-hosted open-source version has the same core billing engine.

Sources citées (3)
🙏

Source et remerciements

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires