forpublicai/lago
forked from getlago/lago
Captured source
source ↗forpublicai/lago
Description: Open Source Metering and Usage Based Billing API ⭐️ Consumption tracking, Subscription management, Pricing iterations, Payment orchestration & Revenue analytics
License: AGPL-3.0
Stars: 0
Forks: 0
Open issues: 0
Created: 2026-10-18T06:53:14Z
Pushed: 2026-10-17T05:14:01Z
Default branch: main
Fork: yes
Parent repository: getlago/lago
Archived: no
README:
“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 at Mistral AI · Read the customer story
---
Build with your AI agent
Give your coding agent Lago's public documentation, then choose the API, CLI, or MCP for your workflow. Paste this prompt to start:
Read https://getlago.com/llms.txt and follow the relevant Lago guides for this project. Use https://swagger.getlago.com/openapi.yaml for exact API fields. Help me design and implement a billing integration. Ask before live access.
| Your task | Start here | | --- | --- | | Build billing into your application | REST API and SDKs | | Inspect billing, run diagnostics, or write scripts | Lago CLI | | Give an assistant tools for live billing data and supported operations | Lago MCP server | | Give your agent current billing and API context | Documentation index or documentation MCP |
These interfaces work independently. Application code uses an SDK or the REST API; no Lago plugin is required. Confirm the target organization and environment, keep API keys out of prompts and source control, and review financial changes before execution.
Follow the agent setup guide for connection details and validation, or explore the website overview. To see real usage become a charge locally, run the maintained demo below.
See Lago price an AI workload
Run the maintained demo from this repository:
./examples/agentic-ai-demo/run.sh
It starts the Lago version that matches this checkout, creates a disposable local organization, and prices three illustrative AI requests. Each request sends one input-token event and one output-token event:
3 AI requests 5,000 input tokens x $0.000002 = $0.01 1,250 output tokens x $0.000008 = $0.01 Lago usage total = $0.02
Docker Compose starts an isolated Lago service, then a small script seeds and verifies the example through Lago's API. It retrieves current usage, independently reconciles the result, and retries one transaction to confirm that usage does not increase. Everything stays on your machine; the demo does not access Lago Cloud. The bundled credentials and API key are disposable and only intended for this local demo.
Log into http://localhost:8080 with agentic-ai-demo@example.local / agentic-ai-demo-local-password, then open Customers → Agentic AI Demo Customer → Agentic AI Demo subscription → Usage.
Requirements: Docker, curl, and jq. If ports 8080 or 3001 are occupied, set LAGO_DEMO_UI_PORT and LAGO_DEMO_API_PORT before running. The demo keeps Lago running so you can inspect the customer, metrics, plan, subscription, events, and usage in the UI. Remove its isolated Compose project and data volume when you are done:
./examples/agentic-ai-demo/run.sh --cleanup
Use Claude Code, Codex, or Cursor
Open this repository in your coding agent and paste:
Run Lago's maintained Agentic AI demo by following this README. Keep it local; do not modify source files or unrelated Docker resources. When it passes, give me the UI URL, token usage and charges, idempotency evidence, and cleanup command. Then offer to connect this agent to Lago's local MCP server.
What is Lago?
Lago is the programmable system between product usage and revenue. Send events from your application, turn them into billable metrics, apply pricing and entitlements, then generate invoices and collect payments.
Usage events -> Metering -> Pricing and credits -> Entitlements -> Invoices -> Payments -> Revenue
Use Lago to launch and change pricing without rebuilding billing:
- tokens by model, input, output, cache, reasoning, or tool call
- GPU, CPU, storage, and other compute consumption
- API calls, transactions, seats, active users, or custom events
- prepaid credits with automatic top-ups
- subscriptions with allowances, minimum commitments, and overages
- self-serve plans and negotiated enterprise contracts in the same system
Lago is headless and API-first. Your application, internal tools, and agents use the same billing primitives through the REST API, SDKs, webhooks, and MCP server. Product, finance, and operations teams can use the Lago UI when a human interface is faster.
How Lago fits into your stack
Lago keeps metering and pricing independent from payment processing. Connect Stripe, Adyen, GoCardless, or another provider without making its product catalog your source of truth.
Lago Direct and Lago Embedded
The same Lago engine supports two operating models:
| | Lago Direct | [Lago Embedded](https://getlago.com/platform/embedded) | |---|---|---| | Who monetizes | You monetize your own product | Your customers monetize through your platform | | Experience | Your application and teams use Lago through APIs, agent interfaces, and Lago UI | Your customers use billing capabilities inside your product through APIs and white-label interfaces | | Brand | Lago powers your billing stack | Lago stays behind the scenes under your brand | | Public example | Mistral AI | PayPal |
Lago Direct is the standard way to use Lago: send your own product usage, model your pricing, and bill your customers. Lago Embedded uses the same primitives to let platforms, marketplaces, AI builders, fintech products, and developer tools offer metering and billing to their customers.
Both models start with Lago's open-source billing engine and can be paired with Premium deployment, customization, security, and support options. With Lago Embedded, you control the customer experience and which capabilities your users can access.
Agentic-first by design
Agentic-first...
Excerpt shown — open the source for the full document.