Open source usage metering

Bill for exactly
what customers use.

Unimeter records every event, aggregates usage in real time, and answers billing questions in microseconds. One binary, zero dependencies, self-hosted.

$ pip install unimeter-python
4.01M evt/s
Async throughput
171µs
Median durable write
0deps
Single static binary
GoPythonTS
First-class SDKs
The whole integration fits on one screen

Define a metric, send events,
read the total.

No database. No message broker. No orchestration framework. Your application talks to Unimeter over a compact binary protocol, and the entire surface area is two methods.

main.go
client, _ := billing.New([]string{"localhost:7001"})
defer client.Close()

// describe what you want to count
client.Metrics.Create(ctx, billing.MetricSchema{
    Code:    "api_calls",
    AggType: billing.AggCount,
})

// record usage as it happens
client.Ingest(ctx, []billing.Event{
    {AccountID: 42, MetricCode: "api_calls", Value: 1},
})

// read the billing total, in microseconds
usage, _ := client.Query(ctx, billing.QueryRequest{
    AccountID:  42,
    MetricCode: "api_calls",
    Period:     billing.CurrentMonth(),
})
async with AsyncClient(["localhost:7001"]) as client:

    # describe what you want to count
    await client.metrics.create(MetricSchema(
        code="api_calls",
        agg_type=AggType.COUNT,
    ))

    # record usage as it happens
    await client.ingest([
        Event(account_id=42, metric_code="api_calls", value=1),
    ])

    # read the billing total, in microseconds
    usage = await client.query(42, "api_calls", current_month())

Two methods to learn

Ingest records, Query reads. The client handles cluster topology, routing, retries, and failover for you.

Durable before acknowledged

Every event is written to disk and replicated to a quorum of nodes before Unimeter confirms receipt. A crash after the "ok" cannot lose it.

Five aggregation types

COUNT, SUM, MAX, LATEST and COUNT_UNIQUE cover per-call billing, metered infra, seat counts and prepaid balances.

Why teams choose Unimeter

A billing source of truth
you actually own.

Self-hosted, nothing to license

One binary you run on your own infrastructure. No per-event vendor pricing, no data leaving your network, no third party owning your billing truth.

Never the bottleneck

Events land in microseconds, totals come back faster. Over four million events per second on a three-node cluster, with headroom to grow.

Correct by construction

Every write is fsynced and quorum-replicated before acknowledgement. A deterministic simulator replays thousands of failure scenarios against formal invariants.

Five lines to integrate

The client handles topology, routing, retries and failover. Your application code gets Ingest and Query, and nothing else to maintain.

Benchmarks

Measured on bare metal,
not on a slide.

3-node cluster · AMD Ryzen 7 7700X · NVMe · private VLAN. Reproducible from the benchmarks repository.

4.01M evt/s
Async throughput
batch = 500
1.70M evt/s
Durable sync throughput
fsync + replicated
171µs
Durable write latency
p50 · p99 224µs
250µs
Tail latency
p99.9
Throughput saturates at 8 workers — bound by disk, not cores events / sec
≈ 4.0M ceiling
1.44M1 worker 2.55M2 workers 4.01M8 workers 4.03M16 · no gain 3.94M64 · no gain

Each node runs a single-threaded event loop, so one instance is bound by disk throughput, not CPU. Past 8 workers the curve is flat — extra workers, and extra cores, buy nothing. You scale Unimeter by adding nodes, not by sizing up a single box.

Built for

Whatever you meter,
it counts it right.

01

Usage-based API billing

Charge by the call, the request, or the token. Attach tags to break usage down by endpoint, feature, or plan tier.

02

Metered infrastructure

Measure compute seconds, storage gigabytes, or bandwidth across regions and providers with one metric and a few dimensions.

03

Seat-based subscriptions

Track who is active right now, not just who signed up. Unique counting keeps the total accurate as teams grow and shrink.

04

Credit & prepaid balances

Combine sums, thresholds, and real-time queries to power dashboards that show remaining credits the instant they change.

Five minutes from zero

Start metering in
one docker run.

Pull the image, install the client, send your first event, query the total back. No account, no signup, no card.