From claude-warehouse
Show token usage and estimated costs in dollars for Claude Code sessions. Use when the user asks about spending, costs, token usage, budget, or wants to know how much their AI-assisted development costs. Breaks down by project, model, and time period.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-warehouse:costsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Show token usage mapped to actual dollar amounts.
Show token usage mapped to actual dollar amounts.
Run ALL of the following queries and present a clear cost breakdown.
When the user specifies a date range, add WHERE clauses. Use these join paths:
sessions.session_id ←→ messages.session_id
sessions.session_id ←→ tool_calls.session_id
messages.uuid ←→ tool_calls.message_uuid (NOT message_id)
Key column differences between tables:
created_at (TIMESTAMP), modified_attimestamp (TIMESTAMP) — NO created_at columntimestamp (TIMESTAMP) — NO created_at columntool_name exists in BOTH messages and tool_calls — always qualify with table aliasTo filter tool_calls or messages by date, JOIN through sessions:
SELECT tc.tool_name, COUNT(*) FROM tool_calls tc JOIN sessions s ON tc.session_id = s.session_id WHERE s.created_at >= '...' GROUP BY 1
SELECT model, COUNT(*) FROM messages m JOIN sessions s ON m.session_id = s.session_id WHERE s.created_at >= '...' GROUP BY 1
Use these rates for estimation:
Note: actual costs depend on the user's plan (Pro/Max/API). Present as estimates.
${CLAUDE_PLUGIN_ROOT}/scripts/query.py sql "SELECT DATE_TRUNC('week', created_at)::DATE as week, COUNT(*) sessions, SUM(total_input_tokens) input_tok, SUM(total_output_tokens) output_tok, SUM(total_cache_read) cache_tok, ROUND(SUM(total_input_tokens) * 3.0 / 1e6 + SUM(total_output_tokens) * 15.0 / 1e6, 2) as est_cost_usd FROM sessions GROUP BY 1 ORDER BY 1 DESC LIMIT 12"
${CLAUDE_PLUGIN_ROOT}/scripts/query.py sql "SELECT project_name, COUNT(*) sessions, SUM(total_input_tokens + total_output_tokens) total_tok, ROUND(SUM(total_input_tokens) * 3.0 / 1e6 + SUM(total_output_tokens) * 15.0 / 1e6, 2) as est_cost_usd, ROUND(SUM(total_cache_read)::FLOAT / NULLIF(SUM(total_input_tokens + total_cache_read), 0) * 100, 1) as cache_pct FROM sessions WHERE created_at >= current_date - INTERVAL '30 days' GROUP BY 1 ORDER BY est_cost_usd DESC"
${CLAUDE_PLUGIN_ROOT}/scripts/query.py sql "SELECT project_name, created_at::DATE, message_count, total_input_tokens + total_output_tokens as total_tok, ROUND(total_input_tokens * 3.0 / 1e6 + total_output_tokens * 15.0 / 1e6, 2) as est_cost_usd, LEFT(first_prompt, 80) as prompt FROM sessions ORDER BY est_cost_usd DESC LIMIT 10"
${CLAUDE_PLUGIN_ROOT}/scripts/query.py sql "SELECT project_name, created_at::DATE, message_count, ROUND(total_input_tokens * 3.0 / 1e6 + total_output_tokens * 15.0 / 1e6, 2) as wasted_usd, LEFT(first_prompt, 80) as prompt FROM sessions WHERE message_count <= 3 AND (total_input_tokens + total_output_tokens) > 10000 ORDER BY wasted_usd DESC LIMIT 10"
${CLAUDE_PLUGIN_ROOT}/scripts/query.py sql "SELECT project_name, SUM(total_cache_read) cache_read, SUM(total_input_tokens) input_tok, ROUND(SUM(total_cache_read) * 3.0 * 0.9 / 1e6, 2) as est_saved_usd, ROUND(SUM(total_cache_read)::FLOAT / NULLIF(SUM(total_input_tokens + total_cache_read), 0) * 100, 1) as cache_pct FROM sessions WHERE created_at >= current_date - INTERVAL '30 days' GROUP BY 1 HAVING SUM(total_cache_read) > 0 ORDER BY est_saved_usd DESC LIMIT 10"
Present as a dashboard with:
npx claudepluginhub sderosiaux/claude-plugins --plugin claude-warehouseDisplays real token usage and estimated savings for current Claude Code session from session logs—no AI estimation. Invoke via `/genshijin-stats` for session stats, `--all` lifetime totals, `--share` summaries, or `--since` periods.
Generates daily cost reports for Claude Code usage including total spend, running sessions, token stats via claude-view MCP tools. Useful for cost, spending, budget queries.