Metrics rollup
In the interactive relay shell, run /metrics for a rollup of token counts,
estimated dollar cost, and wall time across your sessions:
/metricsIt walks the local session store under .agent-relay/sessions/ with no network
calls and no telemetry.
Synopsis
In the relay shell, with no flags, /metrics prints the most recent session.
Use --all for a cross-session rollup:
/metrics [session-id] [flags]From another terminal, agent-relay metrics takes the same arguments:
agent-relay metrics [session-id] [flags]Options
| Flag | Type | Default | Description |
|---|---|---|---|
--all | flag | false | Aggregate across every session in the repo. |
--since | date | none | Lower bound on session start, such as 2026-04-01. |
--agent | name | none | Filter to one or more agent keys. Repeatable. |
--json | flag | false | Emit JSON instead of the formatted table. |
--quiet, -q | flag | false | Print a minimal output format. |
--repo | path | current directory | Repository path. |
Sample output
session agent turns tokens cost wall
─────────────────────────────────── ──────────── ─────── ───────── ──────── ──────
01J9X3M7K5VBHQEN6T2F4D8RPZ claude-code 14 187,420 $1.41 12m
01J9X9N7Q2C5VFGMP4HTSXKDBE codex 9 102,840 $0.78 6m
01J9XAEYR3D2BHQEN8T2F4D8RX claude-code 17 214,950 $1.62 14m
─────────────────────────────────── ──────────── ─────── ───────── ──────── ──────
total 505,210 $3.81 32mCost is estimated from each provider's published per-token rates as of
the time each session ran. The rate table ships inside
agent-relay-tool and refreshes only on agent-relay-tool upgrades —
metrics never hits the network.
Examples
These are slash commands in the relay shell. The same arguments work on
agent-relay metrics from another terminal.
/metricsMetrics for the latest session in .agent-relay/sessions/.
Exit codes
| Code | Meaning |
|---|---|
0 | Rollup printed successfully. |
1 | Metrics could not be read or rendered. |
2 | No sessions matched the filters. |