The open-source usage metering engine for teams that bill by what customers actually use.
Unimeter counts, aggregates, and queries usage events in real time. One binary, no external infrastructure, deploys anywhere from a $5 VPS to a multi-node cluster.
Most usage metering setups require a message broker, a database, and a batch pipeline glued together with custom code. Unimeter replaces all of that with a single self-contained server:
- Real-time queries — ask for a customer's current usage and get an answer in under a millisecond.
- Exactly-once — duplicate events are detected and discarded automatically. Your totals stay correct even when clients retry.
- Replication — 3-node clusters with automatic leader election. Kill a node and the cluster keeps going.
- Zero dependencies — no external databases, no message queues, no third-party libraries. One binary, nothing to install alongside it.
docker run -d --name unimeter \
--security-opt seccomp:unconfined \
-p 7001:7001 -p 9090:9090 \
ghcr.io/unimeter/unimeter:latestInstall the Go or Python SDK, then:
client, _ := billing.New([]string{"localhost:7001"})
// Define a metric
client.Metrics.Create(ctx, billing.MetricSchema{
Code: "api_calls",
AggType: billing.AggCount,
PeriodType: billing.PeriodCalendar,
BillingCycleDay: 1,
})
// Record usage
client.Ingest(ctx, []billing.Event{
{AccountID: 42, MetricCode: "api_calls", Value: 1},
})
// Query
usage, _ := client.Query(ctx, billing.QueryRequest{
AccountID: 42, MetricCode: "api_calls",
Period: billing.CurrentMonth(),
})
fmt.Println(usage.Value.Count) // 1See the full quickstart for a step-by-step walkthrough, or browse the examples for complete runnable scenarios in Go and Python.
| Type | Description |
|---|---|
| COUNT | Number of events in a period |
| SUM | Sum of event values |
| MAX | Largest value observed |
| LATEST | Most recent value by timestamp |
| COUNT UNIQUE | Distinct values with add/remove operations |
- Fixed windows — configurable duration (default 30 days).
- Calendar months — variable-length months with optional billing cycle start day (1–28).
Attach properties to events and query usage sliced by any dimension. Supports single-dimension queries (provider=aws) and multi-dimension AND queries (provider=aws AND region=us-east).
Up to 8 thresholds per metric, checked on every event. Alert history accessible via query API and push subscriptions in the SDK.
3-node clusters with automatic leader election. If a node goes down, the remaining two continue serving reads and writes. When it comes back, it catches up automatically.
Built-in Prometheus metrics endpoint with a Grafana dashboard and k6 load test scenarios.
| Language | Repository | Install |
|---|---|---|
| Go | unimeter/go-unimeter | go get github.com/unimeter/go-unimeter |
| Python | unimeter/python-unimeter | pip install unimeter-python |
Requires Zig 0.16.0.
zig build # build
zig build test # run tests
zig build run # start a single nodeOr use Docker:
docker build -t unimeter .
docker run --rm unimeterFull documentation at unimeter.io:
- What is Unimeter
- Quickstart
- Concepts
- Go SDK
- Python SDK
- Cluster operations
- Stripe integration guide
- Benchmarks
Complete, runnable examples in Go and Python: unimeter/examples
| Example | Description |
|---|---|
| saas-api | API call counting and monthly usage query |
| seat-based | COUNT_UNIQUE seats with add/remove |
| infra-metering | Dimension filters, per-provider breakdown |
| high-throughput | Buffered async ingest at high event rates |
| free-tier-alerts | Alert thresholds and enforcement |
| stripe-integration | Stripe webhook → usage → invoice |
O'SaaSy — MIT with SaaS restriction. Free to use, modify, and self-host. Commercial SaaS offering of the software itself requires a separate agreement.