OpenMeter is a real-time metering and billing engine designed for AI, API, and DevTool companies that need to monetize usage with precision. It solves the complexity of tracking granular events like API calls, LLM tokens, or compute time and converting them into accurate, automated invoices and usage-based pricing models. Built for developers and FinOps teams, it eliminates manual billing workflows and provides real-time visibility into customer usage.
The platform uses a high-performance Go-based architecture with Kafka for event streaming, ClickHouse for real-time aggregation, and PostgreSQL for billing and subscription data. It offers self-hosted deployment via Docker Compose or Kubernetes (Helm), and integrates with Stripe, CRM systems, and custom webhooks. SDKs for Go, Node.js, and Python enable seamless ingestion and querying of usage data.
What You Get
- Usage Metering - Ingest CloudEvents from any service and define meters with SUM, COUNT, AVG, MIN, MAX aggregations to track API calls, LLM tokens, or compute time in real time.
- Usage-Based Billing - Automate invoice generation with tiered, graduated, and flat-fee pricing models, including prorating and mid-cycle plan changes with full invoice lifecycle management.
- Usage Limits and Entitlements - Enforce real-time usage quotas per feature using boolean flags, balance tracking, and grace periods to control access and prevent overuse.
- Product Catalog - Define plans, add-ons, features, and rate cards with support for subscriptions, prorated changes, and flexible packaging without code changes.
- Prepaid Credits - Grant paid or promotional credits with priority-based burn-down rules and expiration policies to support freemium and trial models.
- Customer Portal - Provide token-based self-service dashboards so customers can view their own usage, consumption trends, and billing history in real time.
- LLM Cost Tracking - First-class support for metering AI token usage with model-specific cost calculations (e.g., GPT-4, Claude) and automatic cost attribution.
- Webhook Notifications - Configure alert rules for usage thresholds, billing events, or quota breaches with customizable channels (Slack, email, etc.).
Common Use Cases
- Running AI model billing - An AI startup uses OpenMeter to track per-token usage across GPT-4 and Claude models, automatically generate invoices, and enforce usage limits for free-tier users.
- API monetization for SaaS tools - A developer platform like Requestly uses OpenMeter to meter API calls per customer and sync usage data with Stripe to auto-generate invoices without manual intervention.
- DevOps cost attribution - A cloud engineering team meters Kubernetes pod usage and cloud compute events to assign costs to teams and optimize infrastructure spend with real-time dashboards.
- Freemium SaaS with usage caps - A tool like Trigger.dev uses OpenMeter to track per-millisecond compute usage, enforce free-tier limits, and upgrade users to paid plans based on real-time consumption data.
Under The Hood
Architecture
- Modular monolith with domain-separated Go packages following clean architecture principles
- Dependency injection via Google Wire ensures compile-time resolution and clear service boundaries
- Event-driven design using Watermill decouples event producers from consumers like billing and notifications
- Pluggable infrastructure adapters for Redis, ClickHouse, and in-memory stores enable environment-aware configurations
- Service-layer abstraction enforces separation between domain logic and data access via adapter/service pairs
- Structured health and termination checkers ensure graceful shutdowns across distributed workers
Tech Stack
- Go-based backend with modular command-line services built on standard library HTTP and structured logging
- PostgreSQL with ent ORM and SQLC for type-safe database interactions
- ClickHouse for high-throughput analytical workloads, integrated with visualization tooling
- Kafka for event ingestion and streaming, with dynamic topic provisioning and librdkafka integration
- Redis for deduplication and ephemeral state with strict memory governance
- Docker Compose for orchestration, supported by goreleaser, golangci-lint, and dagger for CI/CD and code generation
Code Quality
- Extensive test coverage across billing, ingestion, and product domains with comprehensive behavioral assertions
- Strong type safety through custom types, explicit structs, and disciplined pointer usage with lo.ToPtr patterns
- Clean separation of concerns with dependency injection isolating services, adapters, and infrastructure
- Consistent naming, wrapped errors for traceability, and meaningful error messages throughout
- Type-safe API specifications generated from TypeSpec with rich OpenAPI annotations for contract-first development
- Automated linting and formatting across Go and TypeScript codebases ensuring uniformity and maintainability
What Makes It Unique
- Native integration of Stripe, custom invoicing, and sandbox modes as first-class app types enables unified billing orchestration
- Event-driven pipeline with Kafka and ClickHouse supports financial-grade precision using Decimal128 for usage calculations
- Dynamic feature-based pricing with LLM cost resolution embedded in API handlers enables real-time, context-aware billing
- Namespaced Kafka topics with automatic provisioning create a self-managing multi-tenant event pipeline
- Comprehensive, type-safe API layer with contextual error mapping ensures reliable client-side error handling
- Portal token system with scoped authentication isolates customer interfaces from core billing logic while preserving security