getlago/lago
FinanceOpen-source metering and usage-based billing platform that turns product events into invoices, payments, and revenue analytics.
What Lago does
Lago sits between product usage and revenue. Applications send usage events, Lago aggregates them into billable metrics, applies pricing and credits, and produces invoices and payment collection. It targets SaaS, AI, compute, and API products that charge by tokens, seats, transactions, storage, or custom events, and it is API-first: the REST API, SDKs, webhooks, and an MCP server expose the same billing primitives, with a web UI for product, finance, and operations teams.
Two operating models share one engine: Lago Direct for billing your own customers, and Lago Embedded for offering white-label metering and billing inside a platform you operate.
Run the local demo
A maintained demo prices three illustrative AI requests without touching Lago Cloud. You need Docker, curl, and jq, and ports 8080 and 3001 must be free (override with LAGO_DEMO_UI_PORT and LAGO_DEMO_API_PORT).
./examples/agentic-ai-demo/run.sh
The script starts an isolated Lago through Docker Compose, creates a disposable local organization, and seeds token events. Open http://localhost:8080 and log in with agentic-ai-demo@example.local / agentic-ai-demo-local-password, then check Customers → Agentic AI Demo Customer → Agentic AI Demo subscription → Usage. Clean up the Compose project and data volume with:
./examples/agentic-ai-demo/run.sh --cleanup
Self-host from source
For a source-based local deployment, clone the repository, generate an RSA private key into .env, and start the stack:
git clone --depth 1 https://github.com/getlago/lago.git
cd lago
echo "LAGO_RSA_PRIVATE_KEY=\"$(openssl genrsa 2048 | openssl base64 -A)\"" >> .env
docker compose up -d
The self-hosted deployment guide covers persistent storage, SMTP, TLS, object storage, Redis, database configuration, and upgrades. For larger deployments, Helm charts and dedicated workers are available.
Interfaces and integration
Core billing workflows are exposed through the REST API and OpenAPI schema, four SDKs (Node.js, Python, Ruby, Go), webhooks, and a CLI. Lago also provides an MCP server and Python/JavaScript agent SDKs for metering LLM usage, released under MIT in separate repositories.
Metering and pricing stay independent of payment processing, so Stripe, Adyen, GoCardless, or another provider can be connected without making its product catalog the billing source of truth. If you self-host, agents inherit the permissions of their Lago API key, so credentials should be treated as privileged and sensitive billing changes reviewed before execution.
Constraints to know
- License: the platform is AGPLv3; the Agent SDKs and MCP server are MIT in separate repositories.
- Front container upgrade: from v1.56.0 the front container runs nginx as uid 65532 with a read-only root filesystem, listens on 8080 (8443 for TLS) instead of 80/443, and needs a writable
/tmp. Custom Compose files, Kubernetes manifests, and reverse proxies must point at the new container ports and mounttmpfsor an emptyDir. - Analytics: self-hosted instances collect basic product analytics by default, with an opt-out documented; Lago states this does not include customer PII or financial data.
- Cloud vs self-hosted: the API and SDKs are identical; only the base URL changes. Lago Cloud is the managed option with commercial support.
HotRepo's take
Lago is a full billing engine with a real codebase and an AGPLv3 license, not a thin wrapper around a hosted service. On 2026-11-14 it appeared at rank 10 in the Go daily list with 27 stars gained that day, though no all-language daily rank is recorded for it. The project's public discussions cluster around billing infrastructure rather than the repository itself: a 2022 thread on engineers' billing nightmares and a 2024 write-up on scaling an events engine with ClickHouse drew hundreds of points, and the ClickHouse thread includes users reporting operational pain with the database alongside praise. Those conversations suggest the problem space is widely felt, but they do not establish how Lago performs in any particular deployment.
Written by AI from the project's README, updated . The project's own docs are the source of truth.
Hacker News
You might also like
- juspay/hyperswitchSelf-hostable payments orchestration that lets teams route transactions across many processors without hard-wiring each integration.
- devaccuracy/ledgerforgeAn open-source double-entry ledger for wallets, payouts, marketplaces and billing, with server-enforced spending limits for AI agents.