openmeter

module
v1.0.0-beta.228 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: Apache-2.0

README

OpenMeter logo

OpenMeter

The open-source metering and billing platform for AI, agentic and DevTool monetization.

Docs | Hosted | Blog | Contributing

GitHub Release CI Status Go Report Card GitHub Stars


OpenMeter is a real-time metering and billing engine that helps you track usage, enforce limits, manage subscriptions, and automate invoicing — all in one platform. Ingest events via a simple API, define meters with flexible aggregations, and connect usage data to billing, entitlements, and customer-facing dashboards.

Features

  • Usage Metering — Ingest events in CloudEvents format, define meters with flexible aggregations (SUM, COUNT, AVG, MIN, MAX), and query usage in real time.
  • Usage-Based Billing — Generate invoices from metered usage. Supports tiered, graduated, and flat-fee pricing with automated invoice lifecycle management.
  • Usage Limits and Entitlements — Enforce usage quotas per feature with real-time balance tracking, boolean feature flags, and grace periods.
  • Product Catalog — Define plans, add-ons, features, and rate cards. Manage subscriptions with mid-cycle changes, prorating, and alignment.
  • Prepaid Credits — Support paid or promotional credit grants with priority-based burn-down and expiration.
  • Customer Portal — Token-based self-service dashboards so your customers can see their own usage.
  • Notifications — Webhook-based alerts with configurable rules and channels for usage thresholds and billing events.
  • LLM Cost Tracking — First-class support for metering AI token usage and computing model-specific costs.

Getting Started

Cloud

The fastest way to start. Start for free and begin metering and billing in minutes — no infrastructure to manage.

Self-Hosted

Run OpenMeter locally with Docker Compose:

git clone git@github.com:openmeterio/openmeter.git
cd openmeter/quickstart
docker compose up -d

Then ingest your first event:

curl -X POST http://localhost:48888/api/v1/events \
  -H 'Content-Type: application/cloudevents+json' \
  --data-raw '{
    "specversion": "1.0",
    "type": "request",
    "id": "00001",
    "time": "2024-01-01T00:00:00.001Z",
    "source": "my-service",
    "subject": "customer-1",
    "data": { "method": "GET", "route": "/api/hello" }
  }'

Query your usage:

curl 'http://localhost:48888/api/v1/meters/api_requests_total/query?windowSize=HOUR' | jq

See the full quickstart guide for more details.

Deploy to Production

Deploy to Kubernetes using our Helm chart.

SDKs

Language Package Source
Go openmeter api/client/go
JavaScript / Node.js @openmeter/sdk api/client/javascript
Python openmeter api/client/python

Don't see your language? Use the OpenAPI spec directly or request an SDK.

Architecture

OpenMeter is built in Go with a stack optimized for high-volume event ingestion and real-time aggregation:

Component Role
PostgreSQL (Ent ORM) Billing, subscriptions, entitlements, product catalog
ClickHouse Real-time usage aggregation and analytics
Kafka Event streaming and ingestion pipeline
TypeSpec API-first design — OpenAPI spec and SDKs from TypeSpec

Community

We'd love to have you involved:

  • Contributing — Start here if you want to contribute code.
  • Code of Conduct — Our community guidelines.
  • Blog — Product updates and engineering deep dives.

Development

Prerequisites: Nix and direnv are recommended. See CONTRIBUTING.md for detailed setup instructions.

make up       # Start dependencies (Postgres, Kafka, ClickHouse)
make server   # Run the API server with hot reload
make test     # Run tests
make lint     # Run linters

License

Licensed under Apache 2.0.

FOSSA Status

Directories

Path Synopsis
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
client/go
Package openmeter provides primitives to interact with the openapi HTTP API.
Package openmeter provides primitives to interact with the openapi HTTP API.
types
Some parts of the OpenAPI spec are not supported by oapi-codegen, such as the "oneOf" and "anyOf" keywords.
Some parts of the OpenAPI spec are not supported by oapi-codegen, such as the "oneOf" and "anyOf" keywords.
v3
Package v3 provides primitives to interact with the openapi HTTP API.
Package v3 provides primitives to interact with the openapi HTTP API.
app
config
Package config loads application configuration.
Package config loads application configuration.
ci module
cmd
balance-worker command
billing-worker command
jobs command
server command
sink-worker command
collector
openmeter
app
dedupe
Package dedupe implements in-process event deduplication.
Package dedupe implements in-process event deduplication.
dedupe/memorydedupe
Package memorydedupe implements in-memory event deduplication.
Package memorydedupe implements in-memory event deduplication.
dedupe/redisdedupe
Package redisdedupe implements event deduplication using Redis.
Package redisdedupe implements event deduplication using Redis.
ent
ingest
Package ingest implements event ingestion.
Package ingest implements event ingestion.
namespace
Package namespace adds a concept of tenancy to OpenMeter allowing to segment clients.
Package namespace adds a concept of tenancy to OpenMeter allowing to segment clients.
pkg
ffx
Package ffx provides a simple feature flag service.
Package ffx provides a simple feature flag service.
framework/operation
Package operation provides an abstraction for RPC-style APIs.
Package operation provides an abstraction for RPC-style APIs.
kafka
Package kafka implements tools to work with kafka Producers and Consumers.
Package kafka implements tools to work with kafka Producers and Consumers.
log
ref
set
test
app
tools
migrate
A very lightweigh migration tool to replace `ent.Schema.Create` calls.
A very lightweigh migration tool to replace `ent.Schema.Create` calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL