AI and LLM usage metering
Record the usage signal once, keep the raw evidence, and roll it up independently from OpenAI, Anthropic, Gemini or whichever billing system you use downstream.
Tokens are useful when your customer contract is token-based. Tasks, runs or requests are often better when the customer buys outcomes. UsageBox does not force an AI-specific unit.
Use the subscription, product-item and meter ingest keys when your account has multiple customers or usage streams. The POST contract stays the same even as the catalog grows.
Generate one idempotency key per logical usage event and reuse it only when retrying that same event. Network ambiguity should never become double usage.
Your provider invoice answers what you paid. Your meter answers what each customer consumed. Keeping those records separate makes margin and reconciliation explainable.
Model- or provider-specific usage can be represented by the meter or product item your application routes the event to. Changing that routing does not require a new ingestion endpoint.
UsageBox stops at measured quantity and rollups. Stripe, a custom ledger or another billing system can apply prices, credits, discounts, tax and invoices downstream.
Product boundary
The metering layer records the usage values your application sends. Provider pricing tables, customer pricing, credits and invoice logic remain separate so they can change without corrupting the usage record.
Choose the usage signal, inspect the exact payload, then create a free key only when the contract fits your integration.