Skip to content
FluxMeter
中文

Open-source AI usage metering · v4.4.1

Meter every token. Attribute every cost.

Open-source usage metering for AI gateways and multi-tenant products — customer-level tokens and cost, without a full billing suite.

Apache 2.0 · HTTP Custody · Python SDK · OpenAPI · Architecture

A usage event becomes an attributed, priced customer usage line.
Usage event POST /ingest
{
  "customerId": "acme",
  "modelId": "gpt-4o-mini",
  "inputTokens": 1200,
  "outputTokens": 400
}

raw event

Customer usage line usage line
{
  "customer_id": "acme",
  "period": "2026-08",
  "input_tokens": 1200,
  "output_tokens": 400,
  "tokens": 1600,
  "cost_usd": "0.00042"
}

customer ledger

Verified camelCase ingest and snake_case usage fields. Not a live backend. Example cost uses gpt-4o-mini catalog rates from engine config/pricing.json (input $0.15/MTok, output $0.60/MTok).

quick start

bash
git clone \
  https://github.com/10kshuaizhang/fluxmeter.git
cd fluxmeter
make demo

Primary wedge

Built for AI gateways and token resellers.

One upstream AI account often serves many downstream customers. Provider totals are not customer-level billable usage.

Upstream provider totals

provider invoice · one pool

Customer-level billable usage

acme · 1600 tok · $0.00042

Illustrative use cases

From model response to usage line.

Core metering first. Control and export stay optional.

  1. Ingest

    SDK or Gateway via HTTP Custody.

  2. Price

    Model-specific input/output token rates.

  3. Attribute

    By customer, period, model, or span.

  4. Control (optional)

    Check, reserve, reconcile.

  5. Export (optional)

    Usage lines to billing or warehouse.

  6. customer-level usage record

One path: HTTP Custody.

SDK/Gateway → HTTP Custody → Kafka ack → Flink billing/aggregation → Redis query → Usage API.

Supported path

make demo starts the only supported full stack. ClickHouse is an audit cold store — not billing truth.

  • make demo = supported stack
  • Gateway: estimate → gate → reserve → upstream → Custody
  • Intelligence stays heuristic / secondary

Engine 4.4.1. Python/JS SDK 2.0.0 are repository versions — package-index publication not reverified.

Run customer-level usage locally.

Run make demo for the supported stack. Query usage from Redis via the Usage API.

Demo compose may leave authentication optional — enable API keys before any public or shared exposure.

Going deeper? Intelligence · Landscape · Compare · FAQ