From ecc
Generates a local Claude Code cost report from a cost-tracker SQLite database, showing spending by day, project, tool, and session. Also supports CSV export.
How this command is triggered — by the user, by Claude, or both
Slash command
/ecc:cost-report csvThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Cost Report Query the local cost-tracking database and present a spending report by day, project, tool, and session. This command assumes a cost-tracking hook or plugin is already writing usage rows to `~/.claude-cost-tracker/usage.db`. ## What This Command Does 1. Check that `sqlite3` is available. 2. Check that `~/.claude-cost-tracker/usage.db` exists. 3. Run aggregate queries against the `usage` table. 4. Present a compact report, or export recent rows as CSV when the argument is `csv`. ## Prerequisites The database must be populated by a local cost tracker. If the file is miss...
Query the local cost-tracking database and present a spending report by day,
project, tool, and session. This command assumes a cost-tracking hook or plugin
is already writing usage rows to ~/.claude-cost-tracker/usage.db.
sqlite3 is available.~/.claude-cost-tracker/usage.db exists.usage table.csv.The database must be populated by a local cost tracker. If the file is missing, tell the user the tracker is not set up and suggest installing or enabling a trusted Claude Code cost-tracking hook/plugin first.
test -f ~/.claude-cost-tracker/usage.db && echo "Database found" || echo "Database not found"
sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
SELECT
ROUND(COALESCE(SUM(CASE WHEN date(timestamp) = date('now') THEN cost_usd END), 0), 4) AS today_cost,
ROUND(COALESCE(SUM(CASE WHEN date(timestamp) = date('now', '-1 day') THEN cost_usd END), 0), 4) AS yesterday_cost,
ROUND(COALESCE(SUM(cost_usd), 0), 4) AS total_cost,
COUNT(*) AS total_calls,
COUNT(DISTINCT session_id) AS sessions
FROM usage;
"
sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
SELECT project, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY project
ORDER BY cost DESC;
"
sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
SELECT tool_name, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY tool_name
ORDER BY cost DESC;
"
sqlite3 -header -column ~/.claude-cost-tracker/usage.db "
SELECT date(timestamp) AS date, ROUND(SUM(cost_usd), 4) AS cost, COUNT(*) AS calls
FROM usage
GROUP BY date(timestamp)
ORDER BY date DESC
LIMIT 7;
"
If the user asks for /cost-report csv, export the most recent usage rows with
an explicit column list:
sqlite3 -csv -header ~/.claude-cost-tracker/usage.db "
SELECT timestamp, project, tool_name, input_tokens, output_tokens, cost_usd, session_id, model
FROM usage
ORDER BY timestamp DESC
LIMIT 100;
"
Format the response as:
Use four decimal places for sub-dollar amounts. Do not estimate pricing from raw
tokens in this command; rely on the precomputed cost_usd values written by the
tracker.
Salvaged from stale community PR #1304 by MayurBhavsar.
npx claudepluginhub elbirador/ai_everything-claude-code/cost-reportQueries a local SQLite cost-tracker database and displays Claude Code usage costs aggregated by day, project, tool, and session. Also supports CSV export.
/statsDisplays Claude Code spending analytics for today, week, month, all, or filtered by tag or branch. Defaults to week when no arguments are given.
/costsDisplays a cost breakdown by provider and workflow for the current session, with cumulative history and estimated costs.
/budgetTracks and reports AI model usage costs from a local JSON log. Shows recent tasks with tier, model, tokens, and cost. Also supports --monthly and --reset flags.
/caveman-statsDisplays real Claude Code session token usage, lifetime savings, and USD cost. Supports --share for a tweetable summary, --all for full breakdown, and --since for time-filtered stats.
/cost-captureGuides through AI provider cost dashboards, captures spend and token usage, compares to previous snapshot, and updates MODEL_ROUTING.md with routing suggestions.