getlago /lago

Open Source Metering and Usage Based Billing API ⭐️ Consumption tracking, Subscription management, Pricing iterations, Payment orchestration & Revenue analytics

★ 10,753⑂ 782👁 51⑃ 494● 235▤ 197
GoCreated 2022-02-28www.getlago.com
10,753
stars
+0+5+83
782
forks
51
watchers
494
prs
235
issues
197
releases
–
discussions

README

Lago

  
    Agentic-first monetization infrastructure for AI products
    
    Meter tokens, compute, API calls, or any product usage.
    Turn usage into pricing, credits, entitlements, invoices, payments, and revenue.
    
    Use Lago Direct for your own product, or Lago Embedded to power monetization for your customers.
    
    
    Talk to us about Lago Cloud
    ·
    Build with your AI agent
    ·
    Run the AI billing demo
    ·
    Documentation
  



  
  
  
  



  



  “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:

text
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:

bash
./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:

text
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 [email protected] / 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 oc

Snapshot: 2026-11-04T14:00:00Z · Data license Apache-2.0 · JSON