Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 10, 2026·2 min de lectura

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.

Listo para agents

Staging seguro para este activo

Este activo primero queda en staging. El prompt copiado pide inspeccionar los archivos staged antes de activar scripts, config MCP o config global.

Stage only · 29/100Política: staging
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Stage only
Confianza
Confianza: Established
Entrada
step-1.md
Comando de staging seguro
npx -y tokrepo@latest install f9227c2e-3474-11f1-9bc6-00163e2b0d79 --target codex

Primero deja archivos en staging; la activación requiere revisar el README y el 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.

Preguntas frecuentes

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.

Referencias (3)
🙏

Fuente y agradecimientos

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados