cost-today — Claude Code command: what it does, how to install
cost-today fetches total token spending and single-line per-model expenses from Agent Monitor.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-analytics@claude-code-agent-monitor-pluginsWhat cost-today does
The command calls a local pricing endpoint at http://localhost:4820/api/pricing/cost. It pulls overall expenditures alongside model-specific stats, returning a lean summary without preambles or tables.
The final output contains the total cost formatted to four decimal places, accompanied by input, output, and cache read/write token counters. It defaults to today when run without parameters, but accepts week as well. Individual models are ordered by cost descending.
Without an active dashboard instance started via npm start in the repository root, the underlying HTTP query fails immediately. Because the endpoint reports lifetime figures, the prompt instructs the agent to state when returned numbers lack window scoping instead of inventing daily cuts.
What it helps with
- check total agent token expenses formatted in USD
- inspect cache read and cache write token usage per model
- review cost breakdown for today or the current week
Example prompts for the agent
- /cost-today
- /cost-today week
- Run /cost-today to inspect fleet expenses
How to install cost-today
1Plugin marketplace
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-analytics@claude-code-agent-monitor-plugins2Manually: put the files in place
.claude/commands/cost-today.mdCall it with /cost-today. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/cost-today.mdCall it with /prompts:cost-today. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/cost-today.prompt.mdManually: put the files in place
.gemini/commands/cost-today.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about cost-today
How to install cost-today in Claude Code?
Run /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then execute /plugin install ccam-analytics@claude-code-agent-monitor-plugins. Alternatively, place the file at .claude/commands/cost-today.md.
What does cost-today do?
It queries http://localhost:4820/api/pricing/cost and outputs the overall dollar figure plus sorted per-model lines with token counts.
What is required to run cost-today?
The local dashboard must be running at port 4820; start it by running npm start inside the repository root.
Source text
cost-today.md · MIT
---
description: Quick total cost plus a per-model one-liner from the dashboard pricing engine.
argument-hint: "[today|week]"
---
Print a quick cost snapshot from the Agent Monitor dashboard pricing engine.
The user's scope is **$ARGUMENTS** (default `today` if empty; accepts `today` or `week`).
Fetch the fleet-wide cost breakdown:
```
curl -s http://localhost:4820/api/pricing/cost
```
This returns `{ total_cost, breakdown: [{ model, input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, cost, matched_rule }] }`.
Then print, concisely:
1. **Total cost** — `total_cost` as USD to 4 decimal places, labeled with the scope (`$ARGUMENTS`).
2. **Per-model one-liners** — one line per entry in `breakdown`, sorted by `cost` descending:
`<model> — $<cost to 4dp> (in <input_tokens>, out <output_tokens>, cacheR <cache_read_tokens>, cacheW <cache_write_tokens>)`
Keep token counts with thousands separators. No tables, no preamble — just the total and the per-model lines.
Note: the endpoint returns lifetime totals; if the user asked for `today` or `week` and the data is not scoped, say so in one line rather than fabricating a windowed number. If the dashboard is unreachable, tell the user to start it with `npm start` from the repo root.
© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor