• REAL-TIME
  • BILLING
  • MONITORING
  • HUMAN

How to track AI token usage with your AI

Connect OpenMeter to your agent to turn every LLM call into a recorded event. Your usage data flows straight into your metering pipeline as it happens.

Ask AI about this page

Short answer

How can I track my AI's token usage?

Your agent uses the ingest_event tool to send token counts and consumption data to OpenMeter immediately after an LLM interaction. This creates a real-time record of exactly how much each request costs or consumes. You get a clear view of usage patterns and billing triggers.

Usage outcomes

Where your data lands.

The AI handles the heavy lifting of reporting consumption.

REAL-TIME

Live event streams

The agent sends data the moment a request finishes. You get immediate visibility into token consumption as it happens.

BILLING

Accurate cost tracking

Every event feeds into your metering pipeline. This makes it easy to calculate costs per user or per request.

MONITORING

Usage visibility

The agent logs specific metrics like prompt and completion tokens. You can see exactly which parts of your app are driving costs.

HUMAN

Manual adjustments

The AI reports what it uses, but you decide how to interpret the billing logic. You retain full control over your pricing models.

The workflow

What your AI does when a request finishes.

The agent acts as the bridge between your LLM calls and your billing system.

  1. Capture usage

    The agent identifies the number of tokens used in the most recent LLM response.

    ingest_event
  2. Format event

    The agent packages the token count and relevant metadata into a structured event.

    ingest_event
  3. Send to OpenMeter

    The agent pushes the event data directly into your metering pipeline.

    ingest_event
  4. Confirm delivery

    The agent verifies the event was accepted by the metering service.

    ingest_event

Try it

Copy these to start.

Use these prompts to begin tracking your usage.

Starting points

Replace the bracketed text with your specific event details.

OpenMeter Connector

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

Connector linkhttps://edge.vinkius.com/vk_preview_p0lNF3lg9UNUFHTVH6Gq1Yu25ac5iomRjqaxflSt/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 — OpenMeter capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "openmeter-usage-metering-for-aicloud-billing-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_p0lNF3lg9UNUFHTVH6Gq1Yu25ac5iomRjqaxflSt/mcp"
    }
  }
}
Copy into chat04
  • Record the token usage for my last request to the customer support bot.

  • Send a usage event to OpenMeter for the user 'dev_user_99' with 500 tokens.

  • Log the consumption for this specific API call including the model name.

  • Track how many tokens the current session has used so far.

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

Start here

Connect OpenMeter once, then ask.

One connection gives your agent access to the metering tools. Your credentials stay encrypted and secure.

Connect OpenMeter to your AI

FAQ

How this task behaves

  • 01

    Can the AI change my billing rates in OpenMeter?

    No. The AI can only send usage events. You must manage your pricing and billing logic within OpenMeter itself.

  • 02

    Does the AI track usage automatically without me asking?

    No. The agent only sends an event when you prompt it to record usage or when you have configured it to do so via your specific workflow.

  • 03

    What kind of data can be sent in an event?

    The agent can send token counts, user IDs, and any other metadata required by your ingest_event configuration.

  • 04

    Can the AI delete previous usage records?

    No. The tools provided only allow for ingesting new events. It cannot modify or delete existing data in your pipeline.

  • 05

    How does the AI know how many tokens were used?

    The agent reads the token metadata from the LLM response and then uses that information to trigger the event.

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

Connect OpenMeter to Claude, Cursor, ChatGPT & more