Skip to main content
Use Lago’s public documentation, REST API, CLI, and MCP server with your AI agent. Start with a product description or pricing model; open your application repository when you are ready to implement. No Lago plugin is required.

Start with a prompt

Paste this into your coding agent:
Describe what your customers pay for. Your agent can use public documentation to propose the customer identifiers, billable metrics, plans, and subscription lifecycle before connecting to a live environment.

Get a first result

Ask your agent to calculate an expected bill before writing the integration. This example follows one customer action through usage, pricing, included credits, and overage, using fictional prices: This is an offline calculation, not proof that your environment is configured correctly. Live validation checks actual Lago results separately. Amounts exclude tax and payment processing. Automated monthly wallet renewal is edition-dependent.

Apply it to your product

Give the agent a product description or pricing page:
Other starting points:
  • API usage: “Model a subscription with included API calls and usage overages.”
  • Prepaid credits: “Help me model prepaid usage, wallet consumption, and what my application should do when credit runs out.”
  • Existing billing: “Help me add Lago usage billing to my existing architecture. Identify which system owns subscriptions, invoicing, and payments.”

Implement in your application

Open the application repository and ask:
Review the proposed customer identifiers, billable metrics, plans, and subscription lifecycle. Your application should use an official Lago SDK or the REST API. It should not shell out to the CLI or require an MCP server at runtime. A useful first validation checks the expected charge, retries the same logical event with the same transaction_id and explicit timestamp, and compares the resulting Lago usage or invoice data with the independently calculated expectation. On organizations using the ClickHouse-based event pipeline, both fields must match for Lago to treat a retry as the same event. A different or omitted timestamp creates a distinct billable event. See Idempotency and deduplication. A successful API response alone does not establish billing correctness.

Choose how your agent connects

Choose the interface your agent supports. The API, CLI, and MCP work independently; you do not need to install all three. Application code should use the REST API or an official SDK.

Build with the API or an SDK

Start with the API reference and developer resources for supported SDKs. Give your agent the complete OpenAPI specification for exact fields. Keep credentials server-side and confirm the US, EU, or self-hosted API URL before sending requests.

Use the CLI

Install with Homebrew on macOS or Linux:
For Go installation and Windows releases, see the CLI setup guide. Inspect the installed version and available commands before building a script:
Follow the configuration guide to select the environment and store credentials. After authorizing live access, verify the resolved target:
These commands contact the configured Lago environment. Review each command’s help for JSON output and dry-run support. A CLI mode named test is not an isolated Lago sandbox.

Connect the product MCP

Follow the MCP server setup guide for the Docker configuration. Set LAGO_API_URL explicitly to the US, EU, or self-hosted API endpoint and provide LAGO_API_KEY through your client’s secret configuration. Start with an authorized read, such as:
Available operations are listed in the Lago Agent Toolkit. The product MCP accesses live billing data; it is separate from the public documentation MCP.

Give your agent the documentation

Use these sources to keep generated code aligned with Lago’s current API and workflows. Configure the documentation MCP as a remote HTTP server in a compatible client. It provides documentation access, not access to your Lago organization.

Validate before live billing

Keep API keys out of prompts, source control, and browser code. Confirm the organization, API URL, affected records, and expected billing impact before live work. Ask your agent to show the proposed changes before executing financial or destructive operations. Use an isolated self-hosted instance for synthetic demos. Lago has no built-in sandbox, and calling a Cloud organization “test” does not isolate it. Follow the integration testing guide when validating your own application.

Optional: install the Lago plugin

The plugin packages Lago billing guidance, worked examples, and an implementation workflow for Claude Code and Codex. It is an optional shortcut for the same API, CLI, and MCP workflows.
The plugin’s public release is in preparation. The installation instructions below apply once the public repository is available. The API, CLI, MCP, and documentation paths above are available now.
The plugin supports Claude Code and Codex. Exploring its offline example and designing an integration require no Lago account, API key, CLI, or MCP connection.
Once the public release is available, run these commands in Claude Code:
Then start with:
The plugin is distributed from Lago’s repository. This installation path does not imply an official OpenAI or Anthropic marketplace listing. Installation identifiers above follow the v0.2.0 release candidate. Explore Lago’s tools for AI agents