openmeter – openmeterio
面向 AI、API 和 DevOps 的计量与计费。实时收集并聚合数百万条使用事件,实现基于用量的计费。
关键指标一览
主题标签
README 详细介绍
OpenMeter
The open-source metering and billing platform
for AI, agentic and DevTool monetization.
Docs |
Hosted |
Blog |
Contributing



!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": "2026-07-07T00: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 |
See Architecture and data flow for a
diagram of the runtime components and their primary interactions.
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.
