Usage & Cost Tracking
The Usage page provides detailed token consumption analytics with time-series charts, per-agent and per-model breakdowns, and cost estimation.
Token Usage Chart
A Recharts area chart shows input and output token usage over time. Select a time range to zoom in:
| Range | Resolution |
|---|---|
| 10 minutes | Per-minute data points |
| 1 hour | Per-minute |
| 6 hours | Per-minute |
| 24 hours | Per-hour aggregation |
| 7 days | Per-hour |
| 30 days | Per-hour |
The chart displays two stacked areas:
- Input tokens (lighter shade)
- Output tokens (darker shade)
Data Collection
Usage data is collected automatically by a client-side collector that:
- Polls the gateway every 10 seconds for session token counts
- Computes deltas (new tokens since last poll)
- Stores snapshots in the PostgreSQL database
Data is aggregated at two levels:
- Per-minute — for short-range queries (≤6h)
- Per-hour — for long-range queries (>6h)
The collector runs in the browser while LordClaw is open. If the dashboard is closed, no usage data is captured for that period.
Per-Agent Breakdown
Below the chart, a breakdown shows token usage per agent with progress bars indicating relative consumption. Click an agent to filter the chart.
Per-Model Breakdown
A similar breakdown shows usage per model (e.g., claude-sonnet-4, gpt-4o, deepseek-chat), also with progress bars.
Cost Estimation
Estimated costs are calculated using a built-in pricing table covering major providers:
| Provider | Models |
|---|---|
| Anthropic | Claude Opus, Sonnet, Haiku |
| OpenAI | GPT-4o, GPT-4o-mini, o1, o3 |
| Gemini Pro, Flash | |
| DeepSeek | DeepSeek Chat, Reasoner |
| MiniMax | M1, M2 |
| Moonshot | Kimi K2 |
Cost projections are shown as daily, weekly, and monthly estimates based on current usage patterns.
Database Requirements
Usage tracking requires PostgreSQL:
# Start Postgres (uses Docker, port 5555)
docker compose up -d
# Run migrations
npx prisma migrate devIf PostgreSQL isn’t running, the Usage page will still show the chart but won’t persist historical data. The collector silently fails and retries on each poll.