Customer usage metering for AI products

See every customer's AI usage. Control what happens next.

Track calls, tokens, agent actions, and custom events by customer. Apply plan limits before expensive work runs, show usage inside your product, and sync trusted usage to Stripe.

5,000 calls per month included · TypeScript SDK or HTTP · Stripe synchronization

Customer usage

Acme Corp

Growth plan

Monthly allowance

84,200of 100,000 actions

84% used
Resets in 12 daysExpected limit in 6 days

Usage by feature

This billing period

Support agent

36,800

Document analysis

27,400

Content generation

20,000

What happens next

Policy active

90%

Notify the account owner

100%

Stop expensive AI work

Overage

Sync trusted usage to Stripe

Checked before each metered action

Understand and control customer AI usage

Meter connects the dots

  • Know who used what

    Attribute each call, token, agent action, or custom event to the right customer.

  • Control usage before cost

    Apply allowances and limits before expensive AI work runs.

  • Spot change early

    See when customer usage rises, falls, or approaches a limit.

One-prompt Meter setup

Give your coding agent one prompt

Paste this into Codex, Claude Code, Cursor, Copilot, or another coding agent. It will inspect the app, choose the safest Meter integration, implement it, and tell you exactly what remains.

Meter firstSDK or HTTPS chosen automaticallyServer-only keysTests and verification

The agent asks only when it cannot safely infer the customer identity or integration target. Gateway and Compress stay out of the first implementation.

Open the canonical agent reference
Paste into your coding agent
Implement UsageTap Meter in this repository.

Read https://usagetap.com/llmreference first and treat it as the canonical contract. The initial goal is Meter only. Do not add UsageTap Gateway, UsageTap Compress, prompt compression, provider migration, model changes, or Stripe synchronization unless I explicitly ask.

Work autonomously:
1. Inspect the repository to find every server-side AI/provider call, the framework/runtime, existing provider SDKs, streaming behavior, tests, environment-variable conventions, and the trusted authenticated customer or tenant ID.
2. Choose the smallest safe integration. Prefer @usagetap/sdk for supported server-side JavaScript/TypeScript provider clients. Use the explicit SDK lifecycle when BLOCK or DOWNGRADE must control provider invocation or model selection; provider wrappers do not invent a safe fallback model. Use direct HTTPS for other languages or when the SDK is not a safe fit. Preserve the existing provider, model, request/response shape, and error behavior.
3. Ask one concise clarification only if a stable server-trusted customerId cannot be inferred or there are multiple materially different integration targets. Otherwise proceed.
4. Implement the complete Meter lifecycle. Attribute every call to a stable customerId and feature; begin before provider work; inspect data.allowed before invoking the provider; do not end a denied call because call_begin already finalized it; finalize an allowed call exactly once on success, error, stream completion, cancellation, or abort; report the actual model and usage returned by the provider; sanitize error metadata; and use one unique idempotency key per logical call, reused only for its retries.
5. Keep all credentials server-side. Never read, print, log, or commit secret values. Add placeholders only to the project's example environment file. UsageTap Meter needs USAGETAP_API_KEY (create a Meter call key, ck-…, at https://usagetap.com/configure#api-keys). Keep the app's existing provider key such as OPENAI_API_KEY, ANTHROPIC_API_KEY, or OPENROUTER_API_KEY.
6. Add or update focused tests and run the relevant test, lint, and type/build checks. If credentials are unavailable, finish and verify the code without attempting a live provider request.

When done, report:
- what you changed and which calls are now metered;
- the exact environment-variable names the user must set, without values;
- any one remaining user decision or action;
- the command or request that produces the first metered call;
- how to verify it at https://usagetap.com/embed-api?features=meter;
- the next Meter step: define customer plans, allowances, and limits at https://usagetap.com/quickstart.

Do not stop at a plan or code sample. Make the changes when it is safe to do so.

Usage signals

Every change in usage means something.

UsageTap shows what changed, for which customer, while there is still time to respond.

Usage is rising

It could mean traction, a new workflow, automation, or abuse.

Usage is falling

It could mean seasonality, disengagement, or early churn risk.

A customer is nearing a limit

It could mean expansion, overage revenue, or an unexpected interruption.

UsageTap surfaces the pattern and customer context. Your team decides what the change means and how to respond.

Provider-neutral metering

Use any provider. Meter any product event.

Track OpenAI, Anthropic, Google, OpenRouter, self-hosted models, API calls, agent actions, and custom product events against the same customer usage record.

View the Meter integration
Your existing request pathOne customer usage record

Identify customer

Check policy

Record provider or custom usage

Customer-facing usage

Give every customer a clear view of their usage.

Put current consumption, remaining allowance, forecast, and plan status inside your product. Customers can act before a limit or invoice becomes a surprise.

Match usage to the language of your product
Show plan status without exposing provider costs
Keep customers and account teams on the same record
Explore customer-facing usage

Your usage

Acme Corp

Growth plan · July 1–31

Approaching limit

84%

of monthly allowance used

84,200 of 100,000
AI actions

15,800

Actions remaining

6 days

Expected to limit

12 days

Until plan resets

We'll notify you before your allowance is reached.

View details →

UsageTap Compress

Smaller prompts. Faster responses. Lower costs.

Reduce conversation history, RAG results, tool output, and application context before they reach the model.

Explore Compress

Plan with your own numbers

Model allowances, overages, and margin before you deploy.

The usage-plan simulator remains available when you are ready to work through pricing details with your own cost and customer assumptions.

Simulate a usage plan

Choose a usage unit

AI actionWorkflowGenerated outputAPI callCreditHybrid plan

Know what every customer is using.

Start tracking AI usage by customer, apply plan limits, and send trusted usage to Stripe.