Who it is for
API and MCP providers who sell metered access to autonomous agents, and platform teams who bill agent tool calls per unit. If your meter and your payment authorizations disagree, you either under-bill or charge for usage you cannot defend. This pack finds the disagreement first.
Quick start
sudo bash install.sh --no-service
cp examples/usage_ledger.json my_ledger.json
./venv/bin/python agent.py --ledger my_ledger.json meter
./venv/bin/python agent.py --ledger my_ledger.json report --out usage_report.md
Each usage event needs event_id, customer_id, sku, a numeric quantity, an ISO timestamp, and the authorization_id that covers it. Anything missing or unreadable becomes an exception, never a silent charge.
local usage_ledger.json
|
v
deduplicate --> check authorization --> price and meter --> reconcile quota + authorized amount
|
billable evidence -----+--> Markdown / JSON report
|
+--> optional BYO-LLM brief
What lands in each bucket
| Bucket | Meaning |
|---|---|
billable_totals |
Units per customer and sku that survived every gate, with the amount pending approval |
over_quota |
Metered usage above included_units, flagged when a hard cap is crossed |
duplicate_events |
A repeated event_id, or a new id replaying an identical call |
missing_authorizations |
Usage with no, unknown, inactive, or mismatched payment authorization |
reconciliation_gaps |
Out-of-period events, unpriced skus, missing entitlements, exceeded authorizations |
manual_review |
Records whose source data is ambiguous, echoed unchanged |
Honest operating modes
| Capability | Deterministic core | Optional BYO-LLM |
|---|---|---|
| Deduplication, quota and authorization checks | Yes | Not needed |
| Pricing arithmetic and billable totals | Yes | Not needed |
| JSON and Markdown reports | Yes | Not needed |
| Prioritized human-readable metering brief | Template summary | Claude Code, Kimi Code, or Codex CLI |
No API key or network call is required. The optional CLI uses the subscription already connected on the machine. This agent produces evidence: it never charges a card, captures a payment, issues an invoice, or changes a customer account.
Commands
python agent.py --ledger my_ledger.json meter
python agent.py --ledger my_ledger.json --period-start 2026-07-01 --period-end 2026-07-31 meter
python agent.py --ledger my_ledger.json report --out usage_report.md
python agent.py --ledger my_ledger.json brief
python agent.py status
python test_agent.py
See CUSTOMIZE.md to connect your own event stream and CHECKLIST.md before you bill from the output.