Administration
Usage and Costs
Gamut tracks every LLM call and computes costs automatically. The usage dashboard breaks down daily spend by agent and by model.
What is tracked
Every time an agent sends a message to the model, the API response includes token usage metadata. Gamut records four token categories for each call:
| Token type | Description |
|---|---|
| Input tokens | Tokens in the prompt sent to the model (user messages, system prompt, tool results) |
| Output tokens | Tokens generated by the model in its response |
| Cache creation tokens | Tokens written into the prompt cache on a cache miss |
| Cache read tokens | Tokens served from the prompt cache on a cache hit |
The counts come from the API response's usage object and are written to JSONL session log files alongside each assistant message.
How costs are calculated
Gamut calculates costs using per-million-token pricing for each model:
| Model family | Input | Output | Cache creation | Cache read |
|---|---|---|---|---|
| Claude Opus 4.6 / 4.7 / 4.8 | $5.00 | $25.00 | $6.25 | $0.50 |
| Claude Opus 4 / 4.1 | $15.00 | $75.00 | $18.75 | $1.50 |
| Claude Sonnet 4 / 4.5 / 4.6 / 5 | $3.00 | $15.00 | $3.75 | $0.30 |
| Claude Haiku 4.5 | $1.00 | $5.00 | $1.25 | $0.10 |
All prices are per million tokens. The cost formula for a single API call is:
cost = (input_tokens * input_price
+ output_tokens * output_price
+ cache_creation_tokens * cache_creation_price
+ cache_read_tokens * cache_read_price) / 1,000,000
When a JSONL entry includes a costUSD field (provided by some proxy configurations), that value takes precedence over the calculated cost.
GPT long-context pricing
GPT models (gpt-5.4, gpt-5.5), available through OpenRouter and the Platform provider, use long-context pricing: once a request's input exceeds the 272K-token threshold, per-token rates rise by 1.5x to 2x depending on the model. Cost calculation applies the higher rate to requests past the threshold.
Model name normalization
Gamut normalizes model names from different providers before looking up pricing. Usage from Bedrock (us.anthropic.claude-opus-4-6-v1), OpenRouter (anthropic/claude-4.6-opus-20260205), and the direct Anthropic API (claude-opus-4-6) all consolidate into a single entry in the usage chart.
Daily aggregation
Usage data is aggregated by calendar day (local timezone) across all session log files. For each day, Gamut computes:
- Total cost across all agents
- Total tokens (sum of all four token types)
- Per-agent breakdown with cost and token totals for each agent
- Per-model breakdown with cost for each model used that day
The aggregation scans JSONL files in each agent's Claude configuration directory. To avoid double-counting, entries are deduplicated by message ID and request ID, keeping only the snapshot with the highest output token count (partial usage updates stream in while a response is generated).
Data retention
Usage data is derived from session log files, so it persists as long as those files exist. Deleting an agent removes its session logs and associated usage data. There is no separate database table for usage; it is computed on the fly from the raw logs.
The usage dashboard
The dashboard in Settings > Usage displays a stacked bar chart of daily costs, with three controls:
Time range
Select from Last 7 days, Last 14 days, or Last 30 days. The API supports up to 90 days.
Segmentation
- Total: A single bar per day showing aggregate cost.
- By Model: Stacked bars colored by model, showing which models drive costs.
- By Agent: Stacked bars colored by agent, showing which agents drive costs.
Scope (auth mode)
In auth mode, admins see a scope toggle:
- My Agents: Only usage for agents the current user has access to.
- All Agents: Usage across the entire deployment.
Non-admin users always see only their own agents' usage.
The chart displays a running total at the bottom right (e.g., "Total: $4.72").
Context window tracking
Gamut also monitors how much of each model's context window is in use during active sessions. Each session's metadata includes the latest context usage percentage, calculated from input token counts relative to the model's maximum context size.
The calculation handles both Anthropic API token counting formats:
- New format:
input_tokensalready includes cached tokens, so it is used directly. - Old format:
input_tokenscounts only non-cached tokens, so cache creation and cache read tokens are added to get the total.
The percentage appears in the session sidebar, giving a real-time sense of how close an agent is to its context limit.
Optimizing agent costs
The dashboard surfaces several cost reduction opportunities:
- Check model distribution. Segment "By Model" to spot agents running on pricier models than their work needs.
- Review per-agent costs. Segment "By Agent" to find outliers. These may benefit from tighter instructions or lower effort settings.
- Monitor cache hit rates. High cache creation costs with low cache read costs mean prompt caching is not paying off. Agents with stable system prompts and tool definitions cache best.
- Watch context window usage. Sessions that consistently near 100% trigger compaction (context summarization), which generates extra output tokens. Tasks that fit within the window avoid that overhead.
- Use scheduled task model overrides. Scheduled tasks accept an optional
modelparameter, so recurring background work can run on a cheaper model without changing the agent's default.