Start with a prompt
Paste this into your coding agent: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:- 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: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:test is not an isolated Lago sandbox.
Connect the product MCP
Follow the MCP server setup guide for the Docker configuration. SetLAGO_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:
Give your agent the documentation
Use these sources to keep generated code aligned with Lago’s current API and workflows.- Documentation index: llms.txt
- Documentation MCP:
https://docs.getlago.com/mcp - Complete OpenAPI contract: openapi.yaml
- Developer resources: API, SDKs, authentication, and webhooks
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.
- Claude Code
- Codex
Once the public release is available, run these commands in Claude Code:Then start with: