Engine · Available
Billing
Usage meters and unit pricing for AI and OCR.
@keystone/engine-billing
Purpose
A dedicated meter for cost-associated platform ops so Document and AI do not invent their own ledgers. Peers call recordUsage through a duck-typed meter; rollups and pricing live here.
In a product
OCR a scanned PDF → Billing records ocr.textract pages → later summarizeUsage for the org’s invoice window.
How it works
- AI chat, embeddings, and steps call recordUsage with token quantities.
- Document OCR and text extract call recordUsage with pages or characters.
- Operators list usage, summarize by kind, and adjust unit prices.
- Each record can publish billing.usage.recorded for observability.
Capabilities
- recordUsage / listUsage / summarizeUsage
- getPricing / setPricing with sensible defaults
- Publishes billing.usage.recorded
- API under /v1/billing (usage, pricing)
Related
AI · Document · Event · Automation