Usage is rising
It could mean traction, a new workflow, automation, or abuse.
Customer usage metering for AI products
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
Monthly allowance
84,200of 100,000 actions
Usage by feature
This billing period
Support agent
36,800
Document analysis
27,400
Content generation
20,000
What happens next
Policy active90%
Notify the account owner
100%
Stop expensive AI work
Overage
Sync trusted usage to Stripe
Meter connects the dots
Attribute each call, token, agent action, or custom event to the right customer.
Apply allowances and limits before expensive AI work runs.
See when customer usage rises, falls, or approaches a limit.
One-prompt Meter setup
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.
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 referenceImplement 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
UsageTap shows what changed, for which customer, while there is still time to respond.
It could mean traction, a new workflow, automation, or abuse.
It could mean seasonality, disengagement, or early churn risk.
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
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 integrationIdentify customer
Check policy
Record provider or custom usage
Customer-facing usage
Put current consumption, remaining allowance, forecast, and plan status inside your product. Customers can act before a limit or invoice becomes a surprise.
Your usage
Growth plan · July 1–31
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
Reduce conversation history, RAG results, tool output, and application context before they reach the model.
Explore CompressPlan with your own numbers
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 planChoose a usage unit
Start tracking AI usage by customer, apply plan limits, and send trusted usage to Stripe.