• REALTIME
  • BATCH
  • AUDIT
  • HUMAN

How to automate usage metering with your AI

Connect Lago to your agent. From there, your AI handles the heavy lifting of reporting usage data to trigger your billing cycles.

Ask AI about this page

Short answer

Can my AI trigger billing based on usage?

Yes. You can tell your agent to send individual usage signals or group them into batches. This moves consumption data directly into Lago to kick off your billing logic.

Usage outcomes

Where your data lands.

The AI routes your consumption signals to these specific states.

REALTIME

Instant triggers

The AI sends a single event immediately. This keeps your Lago meters updated as things happen.

BATCH

Bulk updates

The agent bundles multiple usage points together. This is the best way to handle high-volume data.

AUDIT

Usage history

Every event sent creates a record in Lago. You get a clear trail of what triggered each charge.

HUMAN

Manual review

If usage looks suspicious, the AI stops. You decide if the data is correct before it hits Lago.

The workflow

What your AI does when usage occurs.

Your agent acts as the bridge between your app activity and your billing engine.

  1. Identify usage

    Your agent monitors your application to find billable actions.

    send_event
  2. Report single events

    The AI sends a specific usage metric to Lago the moment an action is detected.

    send_event
  3. Process bulk data

    The agent gathers multiple usage points and sends them in a single request.

    batch_events
  4. Finalize transmission

    The AI ensures the data reaches Lago correctly using either single or batch methods.

    send_eventbatch_events

Try it

Copy these to start.

Use these prompts to begin sending usage data.

Starting points

Swap out the customer IDs and metric names for your actual data.

Lago Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_NNWvW9n3yfSEMxn5gBt3GomfwJtiW443sbi3CFBH/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Lago capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "lago-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_NNWvW9n3yfSEMxn5gBt3GomfwJtiW443sbi3CFBH/mcp"
    }
  }
}
Copy into chat04
  • Send a single usage event to Lago for customer 'user_882' for the 'api_request' metric.

  • Batch these five usage events for 'account_abc' and send them to Lago.

  • Log a single event to Lago for every time 'client_99' uses the 'data_export' feature.

  • Send a batch of usage events for 'org_456' covering the 'compute_hours' metric.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Lago once, then ask.

Link your account once and your credentials stay encrypted. You can then start giving your agent billing instructions immediately.

Connect Lago to your AI

FAQ

How this task behaves

  • 01

    Can the AI change my billing rates?

    No. The AI only sends usage data. It cannot change your pricing, plans, or rates in Lago.

  • 02

    Can the AI delete usage events?

    No. The tools only allow for sending new events or batches. The AI cannot delete or modify data already in Lago.

  • 03

    Can I send usage data in bulk?

    Yes. You can instruct your agent to use the batch tool to send multiple events at once.

  • 04

    Does the AI handle the actual credit card charging?

    No. The AI sends the usage data to Lago. Lago handles the actual payment processing based on your setup.

  • 05

    Can the AI report real-time usage?

    Yes. You can tell your agent to send an event immediately after a specific action occurs.

  • More questions about Lago? The Connector page answers them. See everything the Lago Connector can do

Connect Lago to Claude, Cursor, ChatGPT & more