How openmeterio/openmeter works
OpenMeter is API-first usage-based monetization infrastructure. Its principal workflow accepts usage events, meters and aggregates them, exposes usage queries and access decisions, then supports pricing, subscriptions, credits, and invoicing. The graph highlights those domain stages, the HTTP/API entry layer, and storage. Several domain capabilities are documented in the README but their internal wiring is not shown in the excerpts, so those links are documented rather than inferred from module names.
Main entry points: engine.go Invoice line engine · routes.go API routes · meter_query.go Usage aggregation · server.go HTTP server
Components 19
API and clients
- HTTP server
openmeter/server/server.go - API routes
api/v3/server/routes.go - JavaScript SDK
api/spec/packages/aip-client-javascript/src/funcs/events.ts
Usage metering
- Event ingestion
openmeter/ingest/httpdriver/ingest.go - Event storage
openmeter/sink/storage.go - Usage aggregation
openmeter/streaming/clickhouse/meter_query.go - Meter queries
openmeter/meter/httphandler/query.go
Access control
- Balance updates
openmeter/entitlement/balanceworker/ingesthandler.go - Access decisions
api/v3/handlers/customers/entitlementaccess
Catalog and billing
- Plans and pricing
openmeter/productcatalog - Subscriptions
api/v3/handlers/subscriptions - Customer credits
api/v3/handlers/customers/credits - Invoice line engine
openmeter/billing/lineengine/engine.go - Usage charges
openmeter/billing/charges/usagebased/service/lineengine.go - Flat charges
openmeter/billing/charges/flatfee/service/lineengine.go - Invoice-line queries
openmeter/ent/db/billinginvoiceline_query.go
Other components
- API client
- Usage producer
- Payment and tax providers
Connections 19
- API client → HTTP server: calls API
README.md - API client → JavaScript SDK: uses SDK
README.md - JavaScript SDK → HTTP server: sends requests
- HTTP server → API routes: serves routes
openmeter/server/server.go - Usage producer → Event ingestion: submits events
README.md - Event ingestion → Event storage: stores events
- Event storage → Usage aggregation: inserts events
openmeter/sink/storage.go - Usage aggregation → Meter queries: provides usage
openmeter/meter/httphandler/query.go - Usage aggregation → Balance updates: usage affects balances
README.md - API routes → Access decisions: routes access calls
api/v3/server/routes.go - API routes → Subscriptions: routes subscription calls
api/v3/server/routes.go - Plans and pricing → Subscriptions: defines offerings
README.md - Subscriptions → Invoice line engine: supports billing
- Invoice line engine → Usage charges: delegates usage lines
- Invoice line engine → Flat charges: delegates flat lines
- Usage charges → Invoice-line queries: produces invoice lines
- Flat charges → Invoice-line queries: produces invoice lines
- Customer credits → Invoice line engine: credits billing
README.md - Invoice line engine → Payment and tax providers: integrates providers
README.md