Menu

UsageTap Meter

Meter customer usage. Know when normal changes.

Connect calls, tokens, agent actions, and custom product events to customer accounts. Apply plan allowances before expensive work runs, show customers their current and predicted usage, and send validated totals to Stripe.

UsageTap Guard is included with Meter. Report usage from your existing application for automatic behavioral monitoring, with opt-in email and Slack alerts once supported comparisons have enough usable data.

Already have provider exports? Analyze them locally in your browser.

Customer and feature usageStatus in policy
UsageTap dashboard showing named customer and feature usage

One-prompt Meter setup

Point your coding agent at Meter

Use one prompt to inspect your existing provider calls, choose the right SDK or HTTP path, implement Meter safely, and hand back the exact keys and Meter configuration steps.

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.

For requested daily operational briefs, use MCP get_guard_summary with usage:read alongside usage totals and get_customer_signals. Guard is application behavioral monitoring, separate from customer signals and ordinary usage/cost anomalies. It defaults to the last 24 hours; explicit inclusive startTime and exclusive endTime select a prior day converted to UTC (up to seven days within 56-day retention). Follow nextToken until null and merge finding groups by id; overlapping comparisons are not independent incidents. Keep period findings and saved comparison support counts separate from current readiness. Missing, quiet, stale, pending, disabled or insufficient evidence is not an all clear. Notification email/Slack delivery is sent, skipped or unknown_or_pending; reading does not send alerts or enable opt-ins. There is no SDK Guard-summary method.

POST /call, /call_begin, /call_end and /custom_meter use fast index-based key authentication. Revoked/replaced keys and previous permissions may remain usable there until index propagation, with no promised maximum delay. Other durable-key requests recheck the current primary record and fail closed on verification failure. New/replacement key discovery, issued-session lifetimes and the internal verifier's permitted 30-second positive cache retain their existing behavior.

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.

If this application already uses UsageTap Gateway, extend its existing requests instead of adding a second LLM metering lifecycle. Read https://usagetap.com/docs/LLM_GATEWAY. Send top-level taskId and taskType on Chat Completions/Responses requests, including streams, or in each native batch item's body. Gateway validates these fields, forwards them to call_begin, and removes them before provider dispatch.

Start by wrapping the application's existing LLM calls. New UsageTap workspaces receive a Metering plan with unlimited calls and output tokens and no plan quota blocking. Existing workspaces retain their configured plans; do not overwrite them or bypass their enforcement. Pricing tiers, limiting, and usage widgets are optional follow-up work, not prerequisites for a new workspace's first metered call.

When the requested target is HTTP API requests or MCP tool calls, use the dedicated Agentic & API Calls meter: POST /custom_meter or incrementCustomMeter with meterSlot AGENTIC_API and a positive integer amount. Read https://usagetap.com/llmreference#agentic-api. Configure the allocation, eligible purchased credits, PAYG funding and single or graduated prices just like a custom meter. Report completed usage with a stable idempotency key; inspect data.blocked and enforce it in the application. This reporting API does not reserve credit or impose rolling rate limits. Skip the provider-specific lifecycle, model and token steps below for this target; those steps apply only to LLM usage.

Read https://usagetap.com/docs/GUARD_INTEGRATION to make recorded usage useful for Guard. Send stable customerId and feature plus optional customerUserId, taskId, and stable taskType as top-level fields on call_begin and meter reports. Propagate one operation's taskId across LLM calls, tools, and workers, with separate idempotency keys for each event. runId is SDK-local circuit-breaker state, not remote task attribution. Verify installed wrapper transport because older SDK builds may accept task fields in types but omit them. Use explicit withUsage/beginCall until a fixed build is available. For HTTP labels send sanitized metadata.method/endpoint; for MCP send metadata.toolName and optional serverName. Arbitrary metadata/tags are not additional Guard detector dimensions. API/custom-meter task-type mix compares reported consumption shares, with update shares supporting batching investigation; unspecified taskType remains measurement context. It does not count distinct/completed tasks or create taskId baselines. Report real consumed units and keep batching consistent; one report is not necessarily one consumed call. Preserve actual total input/output, cache subsets, provider/model, and known pricing/reasoning settings; omit unknown usage rather than inventing zeros.

Verify linked usage with GET /usage/monitoring?customerId=...&taskId=... or MCP get_task_usage using usage:read. No SDK task-read method exists. Follow every nextToken; totals cover each page only. Report missing-cost/open-call counts and keep LLM cost separate from commercial meter charges. Task completion and cost per completed task are not inferred. Guard monitors reported application behavior automatically for all organizations. Organization administrators can inspect evidence; offline detector preflight remains restricted to UsageTap platform administrators. Only R1 collection runs; R0 evaluation, historical initialization, configured Guard rules and incident handling are retired. Cache reuse, output/input, output size and API/custom-meter feature mix have population comparison adapters. Genuine calls/reports remain the sampling units; quantities do not invent independent calls. Applications automatically compare trailing two-hour populations using each detector's supported calendar history. The organization timezone is used, with an explicit UTC default. Same-weekday, weekday/weekend and daily references activate according to eligible support; sparse checks use labelled recent compatible history. Customers do not configure comparison policies. Dense calendar periods are reproducibly sampled without replacement, up to 256 observations per historical period and 4,096 current observations. Numeric comparisons use 512 observations per population within those caps, dividing the reference budget across periods to bound exact-test runtime. Periods below their allocated quota retain every observation. Categorical recent-history fallback can use the 4,096-observation reference budget. Full recorded counts, missingness and sampling support remain separate; samples can miss rare changes. Provisional sampling assumptions and a per-assessment statistical budget do not establish a daily or lifetime false-positive rate. No policy or insufficient/descriptive evidence is not health. Recorded cost-per-call distributions, reported completion reasons and denominator-based token/user/task coverage have comparison adapters. Missing historical measurements stay unknown. Token coverage and end-user attribution coverage measure eligible completed LLM calls; API/custom attribution coverage measures genuine reports. Historical LLM samples without the user-coverage measurement stay unknown; reporting an ID does not establish authorization or enable individual-user behavioral monitoring. Errors compares the recorded response-code distribution across eligible finalized successes, failures and timeouts, including shifts among successful codes; missing codes stay unknown. API call rate uses reported AGENTIC_API quantities over five-minute exposure with an explicit daily UTC reference. Batches do not reveal individual call times; missing/delayed windows remain unknown. Detector preflight replays saved offline cases. Application comparisons are enabled across organizations; customer detail is investigated on demand. Change and recovery notifications use the existing UsageTap Guard email/Slack opt-ins and shared destinations; neither channel is enabled automatically. Guard Settings provides separate Alert and Notification dropdowns per detector, each with Off, All, Major. All includes minor and major changes. Development is the default preset for organizations without saved detector settings: major behavioral alerts and notifications, with Environment mix Off. Production uses Alert: All and Notification: Major for every connected detector. Individual overrides show Custom; presets populate the existing controls and apply on Save. Existing saved preferences keep their behavior. Alert: Major keeps smaller or unclassified changes neutral in evidence/history, without warning icons, active findings or amber timeline emphasis. Alert: Off removes visual alerts while allowing opted-in notifications; both Off skips evaluation. Both levels are saved together in the existing detector preference. Notification: Off stops pending delivery; channel opt-in is still required. Meter recording and saved findings are preserved. The Production preset shows all supported changes; notifications default to major changes, with an optional all-supported-changes setting per detector. Major means detector-specific change magnitude, not proven harm or confidence. A smaller change can notify when it first becomes major. Repeated changed windows do not repeat alerts. Recovery requires a completed no-change comparison and is sent only on a channel that received the change alert; quiet, unknown and unavailable evidence never establish recovery. There is no incident case-management workflow or automatic blocking. Task lookup and configured Meter enforcement remain separate. Do not change plans or notification preferences unless requested.

In the application, use Meter → Guard → Dashboard or Live View → Guard for detector status, active findings and compact history. Findings retains earlier changes, expandable evidence and recorded task lookup. Integration guide opens the instrumentation instructions; Email / Slack notifications opens the existing notification settings. Enable UsageTap Guard changes and recovery only when requested. Notification destinations are shared with other admin alerts.

Set USAGETAP_ENVIRONMENT=production or test in the server deployment, or configure UsageTapClient defaultEnvironment. SDK and observer read that variable; direct HTTP must send X-UsageTap-Environment on every UsageTap request, including customer creation, reads/updates, call_begin/end and custom_meter. Do not send it to provider requests, infer from NODE_ENV, or hide it in metadata/tags. A customer-panel Traffic group pin overrides request labels for new usage. Respect it and do not change admin groups unless asked. Automatic restores request labels; without a pin, omission stays unlabelled. Existing usage, active calls and retries keep their recorded group. Preserve the label across retries and workers; explicit lifecycle conflicts are rejected. Verify outgoing headers and stored labels with a supporting SDK release. One customer ID can have both labels. Filters do not create separate allowances, change Stripe mode, make test traffic free, or partition customer signals. Page-level Environment filters group unlabelled usage with Production and keeps Dev/Test separate; API header filters still match exact recorded labels. Usage Forecast defaults to All traffic, offers Production, and does not offer Dev/Test-only forecasting. Guard behavioral checks always compare Production + unlabelled usage with matching retained history. Dev/Test is excluded from those checks. A separate environment-mix check uses all recorded traffic to detect substantial Dev/Test growth and share increases; it follows existing Guard notification opt-ins. There is no Dev/Test inclusion setting. Viewing filters do not change detection, and eligible retained history is reused without restarting learning.

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. Report optional top-level completionReason at call_end/endCall from the primary provider finish_reason, stop_reason, or Responses incomplete_details.reason (otherwise terminal status such as completed). Omit unknown values; never infer from HTTP 200 or token counts. Use a supporting package release or direct HTTP, and verify the outgoing payload. Values are trimmed, 1-128 characters, without control characters. This does not change pricing/lifecycle. Guard can compare reported reason categories when sufficient eligible data is available. 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 utk-… key with usage:write 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 watch it in Live View at https://usagetap.com/live and find the completed request in recent calls at https://usagetap.com/dashboard#recent-calls;
- the integration guide at https://usagetap.com/embed-api?features=meter if setup needs attention;
- optional next steps in Control Center at https://usagetap.com/dashboard?tab=system. The first successful metered call completes the initial setup.

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

Product walkthrough

See the customer usage experience working together.

Move from named customer usage to current allowances, forecasts, status, and plan controls in one short walkthrough.

The walkthrough is silent and loops automatically. A static dashboard is shown when reduced motion is preferred.

UsageTap in actionCustomer → usage → policy
Static UsageTap dashboard showing usage, forecast, status, and limits

Provider-neutral integration

Use any provider. Meter every customer consistently.

Meter OpenAI, Anthropic, Google, OpenRouter, self-hosted models, or any HTTP call. Use the direct SDK for agent actions, API requests, generated outputs, and other custom product events that never touch an LLM.

Read the full Meter SDK reference →

Provider or route

Integration style

Your selection

Keep the OpenAI SDK and add the UsageTap SDK to meter usage.

Install
npm install @usagetap/sdk openai
OpenAI · UsageTap SDK
import OpenAI from "openai";
import { withMetering } from "@usagetap/sdk/openai";

const provider = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

// Set USAGETAP_ENVIRONMENT=production (or test) in the server deployment.
const openai = withMetering(provider, {
  apiKey: process.env.USAGETAP_API_KEY,
  customerId: currentCustomer.id,
  feature: "chat.reply",
});

const response = await openai.responses.create({
  model: "gpt-5.6-luna",
  input: prompt,
});

Keep your providers and application. Connect usage to the business.

Providers continue to run AI calls and your application continues to run custom workflows. Stripe owns subscriptions, invoices, and payment. UsageTap owns the customer usage record and the policy around it.

AI provider or your application

  • Runs or routes the AI request
  • Returns vendor usage and cost when available
  • Performs custom workflows and product actions
  • Continues to own provider availability

UsageTap Meter

  • Attributes usage to each customer
  • Applies allowances and limits
  • Shows customer-facing usage
  • Forecasts runout and alerts on changing patterns
  • Creates a validated usage record

Stripe or commerce platform

  • Owns subscriptions
  • Creates invoices
  • Collects payments
  • Manages payment methods

From event to trusted usage

The customer-facing control loop.

UsageTap dashboard grouping usage by customer and feature

Meter

Know who used what.

Attribute calls, tokens, agent actions, and custom events to the correct customer, tenant, feature, or workflow.

UsageTap customer allowance and limit controls

Control

Stop expensive surprises before they happen.

Check allowances and limits before running costly AI work.

UsageTap forecast chart showing expected call volume

Forecast

See where usage is heading—and when the pattern breaks.

Estimate runout, compare finalized usage with its learned baseline, and route confirmed changes to email or Slack.

UsageTap usage-plan configuration for commerce synchronization

Synchronize

Send trusted usage to Stripe.

Synchronize validated usage while Stripe continues to own subscriptions, invoices, and payments.

UsageTap Guard · Included with Meter

Know when normal changes.

Reported usage shifts from search to exports. API call consumption rises. A familiar LLM workload changes its output sizes. Guard compares application usage to help investigate possible misuse or runaway work.

Organization administrators can inspect saved application comparisons, reported feature and task-type shares, and coverage gaps. Enable email or Slack notifications to hear about eligible changes without watching the dashboard. Both channels default off.

Investigate changing LLM behavior

Call totals can stay steady while input/output proportions, cache reuse, response sizes, cost-per-call distributions or reported completion reasons change. Token and attribution coverage show gaps in the available evidence. Customer and task context supports investigation; current detection compares application behavior.

Investigate changing API and metered work

Feature and task-type consumption shares can change while total calls or units stay steady. Compare each application meter separately. API call rate uses reported consumption and a daily UTC reference; update shares help explain batching.

Guard flags usage changes for investigation. Monitoring does not automatically block traffic; separately configured Meter controls enforce supported policies where your application applies them.

Spend protection

Set the limits you know. Get alerted to the changes you didn't.

Meter protects known boundaries before work begins. Its anomaly system watches finalized usage and spend for material changes, confirms noisy signals, and tells your team what was observed versus expected.

Known boundaries

Apply allowances, burst controls, and hard limits before an expensive agent action or model call runs.

Unexpected changes

Learn normal usage and spend patterns, group related signals into incidents, and notify email or Slack.

Two spend clocks

Use authoritative daily OpenAI or Anthropic reports alongside faster hourly estimates from metered calls.

UsageTap spend forecast comparing observed and expected spend with two confirmed anomaly incidents
UsageTap AI spend summary showing monthly budget, projected spend, provider reconciliation, hourly estimate, and confirmed incidents

Example workspace using provider-reported daily spend and UsageTap hourly estimates. Alert sensitivity is separate from the exploratory chart control shown here.

Why we built this guardrail

A runaway agent changed the bill before it changed our mental model.

In July, a runaway agent process in FocusedFit.ai pushed one day of provider spend far outside its normal pattern. That experience is why Meter pairs hard limits for known boundaries with anomaly alerts for changes teams did not anticipate.

Anomaly alerts notify your team; configured Meter limits are what enforce policy before work begins.

Usage changes are business signals.

UsageTap gives your team the customer, feature, and usage context needed to investigate and respond.

Rapid increase

A customer may be adopting a new workflow, automating more work, approaching an upgrade, or generating abusive traffic.

Gradual decline

A customer may be experiencing seasonality, disengagement, reduced adoption, or early churn risk.

Approaching an allowance

A customer may need an upgrade, an overage path, or an earlier warning.

Cost rising faster than value

A model, workflow, or customer behavior may be creating margin pressure.

These patterns are starting points for investigation, not automatic classifications of traction, expansion, abuse, or churn.

Customer-facing usage

Show customers where they stand.

Put current consumption, remaining allowance, forecast, and status inside your product so customers can act before a limit becomes a surprise.

Embedded UsageTap usage overview with current and remaining allowances
Embedded UsageTap forecast showing expected usage

Infrastructure and extensibility

Technical depth when you are ready to evaluate it.

Start with one customer and usage unit, then fit Meter into the event, observability, and commerce systems you already run.

Custom meters and dimensions

Define calls, tokens, generated outputs, searches, audio minutes, agent actions, or another value unit, then attach customer, tenant, feature, and workflow context.

Event APIs and SDKs

Use the TypeScript SDK or plain HTTP to begin work, record completed usage, and query customer usage status.

OpenTelemetry and webhooks

Send operational telemetry to OTLP-compatible tools and deliver usage or policy events to the systems your team already runs.

Commerce outputs

Synchronize validated usage with Stripe today. Keep planned commerce integrations such as Paddle and Clerk separate from the available path.

Production evidence

FocusedFit.ai came for customer metering. Production visibility found something else.

FocusedFit.ai needed customer attribution, plans, limits, and a trusted usage record for billing. Inspecting the resulting production calls also exposed broken prompt caching, truncated source data, and duplicated context.

Read the production case study →
Input tokens cached
~71%

Representative production calls

Major context payload
150 KB → 40 KB

After the application was corrected

Further compression estimated
3–5%

Runtime Compression not enabled

FocusedFit.aiDocumented production case study
AskPilot.ioAlso running UsageTap in production

Simple prepaid pricing

Meter real customer usage before you pay.

Start without a subscription or credit card. Meter includes 100,000 usage events free every month. After that, graduated rates start at $0.20 per 1,000 events and fall to $0.05 per 1,000 at scale, deducted from the same prepaid UsageTap Balance used across the product. These published Meter rates are all-in; no additional UsageTap percentage fee is added.

See all UsageTap pricing

Included when you start

$0 to start

100,000 usage events free every month.

Starter balance
$10
After free usage
$0.20 / 1K eventsGraduated down to $0.05 / 1K
Payment details
Not required to start

FAQ

Clear boundaries before you integrate.

Does UsageTap replace an AI provider?+

No. Your provider continues to run or route the AI request. UsageTap attributes the resulting usage to a customer and applies your usage policy around the call.

Does UsageTap create invoices or collect payments?+

No. Stripe or your commerce platform continues to own subscriptions, invoices, payment methods, and payment collection. UsageTap sends validated usage to that system.

What can I meter?+

You can meter calls, tokens, agent actions, custom events, and product-specific usage units. Customer, tenant, feature, and workflow identifiers keep the record attributable.

Does UsageTap decide whether a usage change means churn or abuse?+

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

Does anomaly detection automatically stop a runaway agent?+

No. Anomaly detection confirms unusual usage or spend and alerts your team. Configured Meter allowances, burst controls, and hard limits are the controls that enforce policy before expensive work begins.

Connect one AI feature and see who is using it.

Start with calls or tokens, then add allowances, customer-facing usage, and Stripe synchronization as you grow.