Retrieval-augmented generation (RAG) is everywhere, yet most billing stacks still treat it like a simple chat API. This RAG usage metering guide shows how to meter embeddings, retrieval depth and completion spend separately, so the eventual invoice reflects the value your knowledge base delivers.
RAG Workloads to Meter Separately
- Ingestion pipelines: Document syncs, chunking, and vector writes often happen hours before a prompt, but you still need to capitalize that cost.
- Retriever fan-out: Hybrid search invokes multiple indexes (BM25 + dense + rerankers) with unique SLAs.
- LLM completions: Prompt + completion tokens skyrocket when context windows inflate past 120K.
Telemetry Schema
UsageBox does not accept arbitrary metadata on the public usage endpoint. Model each independently billable RAG stage as its own configured meter or product-item stream, then send the numeric quantity against the customer subscription:
{
subscription: 'sub_customer-...',
product_item: 'item_rag-retrieval-...',
meter: 'meter_documents-touched-...',
value: 12
}
If you need index names, guardrail scores, model ids, or other diagnostic attributes, keep them in your application telemetry and use stable UsageBox meter/product-item keys for the quantities that must roll up for billing.
Pricing Patterns for RAG
- Tiered retrieval depth: Charge per
documents_touchedbucket (1-8, 9-24, 25+). Include a precision mode toggle for legal workloads. - Vector storage rental: Bill per GB/month with surge pricing for hot shards.
- Context expansion add-on: Monetize prompts > 32K tokens separately; tie to context window metering.
Observability + Enforcement
Metering can supply the quantity your application uses for budget or entitlement decisions, but UsageBox does not sit inline as an authorization or guardrail engine. Keep enforcement in your gateway or application:
- Read or derive the customer's current allowance in your application before expensive retrieval work starts.
- Trip your own guardrails, rate limits, or feature flags when the policy threshold is reached.
- Use the UsageBox event history and rollups as the independent quantity record behind later billing or reconciliation.
Proving ROI
Every RAG invoice now includes source coverage (how much of the knowledge base was touched), answer confidence, and latency bands. Those data points turn a nerdy metering exercise into a customer-facing SEO honeypot about “RAG transparency” while arming sales with renewal ammunition.