Overview
What Token Meter does
Token Meter shows what your AI use costs, and who and what it was for: each customer, feature and team. This page explains how usage gets in, with a two-line example, and what the SDK will and won't do to your app.
What it does
Your AI provider's bill tells you the total. Token Meter splits that total by customer, feature and team. You can see what each customer costs to serve and where the money goes.
The main way in is the SDK (a small library you add to your app). One call wraps the AI client your code already creates: tokenmeter.wrap() in Python, or wrapOpenAI() and its siblings (wrapAnthropic(), wrapGemini(), wrapBedrock(), wrapAzureOpenAI()) in TypeScript. Your calls keep working exactly as before.
After each call, the SDK reads the token counts from the provider's reply. It adds the tags active at that moment (action, customer, feature, team, environment, project and member) and sends it all to Token Meter in the background. Each provider reports usage in its own format. Token Meter converts them into the same five counters (input, output, cache read, cache write and reasoning tokens), so cost is worked out the same way for every provider.
Two-line quickstart
Install, start, wrap. That is the whole setup for a provider client. The key (tl_live_…) comes from Governance › API keys in the dashboard, saved in the TOKEN_METER_KEY environment variable.
// npm install @tokenmeter/sdk openai
import OpenAI from "openai";
import { TokenMeterClient, wrapOpenAI } from "@tokenmeter/sdk";
const tl = new TokenMeterClient({ apiKey: process.env.TOKEN_METER_KEY ?? "" });
const openai = wrapOpenAI(new OpenAI(), tl);The full quickstart takes you step by step from creating the key to seeing your first call on the dashboard.
What the SDK is and isn't
It is not a proxy
The SDK never sits between your app and the provider. It reads usage from the reply after the provider has answered. There is no extra network hop, and it cannot slow down, retry, rewrite or block a call. If the provider call fails, its error reaches your code unchanged. Only Token Meter's own record-keeping is wrapped so that it can never fail your call.- Does: record usage after each call, convert it to the same counters for every provider, tag it with the active attribution, and send it in the background.
- Does not: add delay or a network hop to your call, block or slow a call, or throw an error during a provider call.
Two setup mistakes do raise an error, on purpose, when the SDK starts: Python's tokenmeter.init() raises if a governance option has a value it doesn't recognize, and, if you use governance preflight, TypeScript's new GovernanceClient() throws if apiKey or routerUrl is empty. An empty key does not: from SDK 0.2.2 the SDK prints a warning (in TypeScript, through onError if you set one), records nothing and your app runs as before. (The Python line above reads the variable with os.environ[...], which itself raises KeyError when it is not set.)
One feature is on the call path by design, and only if you turn it on: governance preflight checks a direct call with the Router before it runs, so it adds a round trip and can stop the call.
If you would rather change configuration than code, the Router meters OpenAI-compatible and Anthropic traffic when you point your client's base URL at it.
See Reliability for the full set of guarantees and the known failure modes.
Beyond the SDK
The SDK is one way in. These guides cover the rest of the dashboard and how to set each part up.
- Coding agents: connect Claude Code, Codex, Cursor, Copilot and other coding tools and see usage per developer
- AI Bill: import what providers and clouds actually bill and see one total per month
- Router: meter OpenAI-compatible and Anthropic traffic by changing a base URL instead of code
- Gateway & routing: routing policies, fallbacks, caching, Recall, experiments and evaluations (the Router pages in the dashboard)
- Governance & alerts: API keys, budgets, rules (guardrails and Shadow AI), the activity log, alerts and the Inbox
- Customers & clients: margin per customer, projects, clients and the client portal
- Tool fees: count what search and tool APIs like Tavily or Exa cost your app, next to its model spend
- AI Impact: tie AI spend to pull requests and tickets with GitHub and Jira (the Repositories and Delivery pages under Coding tools)
- Workspace admin: plans, roles, people, teams and business units
- Single sign-on: SAML 2.0 and OpenID Connect sign-in for your workspace