Metering
Metering
Section titled “Metering”Metering is the aggregation of tokens, cost, and call counts across every governed call.
Per-session totals roll up to per-agent → per-project → per-org. Operators answer "what did this cost?" and "who's about to blow the budget?" from one place.
Metering is derived, not stored separately — it's a query (and pre-aggregated rollups) over the audit trail's call events.
At a glance
Section titled “At a glance”| Derived from | Audit trail events on every LLM and tool call |
| Tracks | input tokens, output tokens, cost (USD), call count, latency p50/p99 |
| Rolled up by | session → agent → project → org · day / week / month |
| Drives | cost dashboards, budget alerts, the cost.budget.* pipeline-step family |
| Status | next |
What it tracks per call
Section titled “What it tracks per call”Every LLM and tool call writes a row carrying:
| Field | Source |
|---|---|
input_tokens | LLM provider response usage block |
output_tokens | LLM provider response usage block (streamed) |
cost_usd | input/output × per-vendor unit price (current pricing table) |
latency_ms | wall clock from request entry to response complete |
tool_call_count | tool/MCP calls during the same session |
cache_read_tokens / cache_write_tokens | for vendors that support prompt caching |
How rollups work
Section titled “How rollups work”Pre-aggregated counters in PostgreSQL keep dashboard queries fast:
Session totals (1 row / session, finalized at session end) │ ▼ Daily agent totals (1 row / agent / day) │ ▼ Daily project totals (1 row / project / day) │ ▼ Daily org totals (1 row / org / day)Live (in-flight session) counters live in the Session's context — finalized on session end.
Why this concept exists
Section titled “Why this concept exists”Metering is the economic view of a session, distinct from:
- Pipeline findings — what was caught
- Tool footprint — what was done
- Metering — what it cost + how much was used
Metering also drives enforcement: the cost.budget.session, cost.budget.agent, cost.budget.org pipeline steps read live counters and reject calls when limits are hit.
Surfaces
Section titled “Surfaces”| Persona | Surface | What they see |
|---|---|---|
| Operator | Costs dashboard | Daily/weekly burn per project, top-N agents, per-vendor split |
| Operator | Per-agent detail | Live session burn vs budget, history |
| Finance | Monthly statement | Org rollup, broken down by team / project |
| Pipeline step | cost.budget.* reads counters | Reject calls when threshold exceeded |
| BYOK customer | BYOK dashboard | Same data scoped to their own credentials |
Related concepts
Section titled “Related concepts”- derived from ← Audit trail
- scoped to ← Session → agent → project → org
- drives →
cost.budget.*pipeline steps (enforcement) - adjacent to ↔ Pipeline findings, Tool footprint