agentsclimarketplace

Token usage

Skill citedy/skills/skills/token-usage

Curated collection of skills by Citedy — AI-powered SEO content automation

Install
npx -y skills add citedy/skills --skill token-usage

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Analyze Claude Code token consumption and estimated costs across projects and sessions. Use when user asks about token usage, costs, spending, billing, how much they've used, or wants to optimize their Claude Code usage patterns.

SKILL.md

2.8 KB, as published. Nobody here has run it

Token Usage Analyzer

Analyze token consumption patterns and estimate costs from Claude Code session files (~/.claude/projects/).

What It Does

  • Parses all JSONL session files to extract token metrics (input, cache creation, cache read, output)
  • Groups usage by project and session
  • Estimates costs based on Claude model pricing
  • Identifies most expensive sessions and subagent usage
  • Supports time range filtering (today, week, month, N days, specific date)
  • Generates a detailed markdown report

Usage

Run the analyzer with a time range argument:

python3 .claude/skills/token-usage/scripts/analyze.py $ARGUMENTS

Arguments

ArgumentExampleDescription
(empty)All time
todaytodaySince midnight UTC
weekweekLast 7 days
monthmonthLast 30 days
N (number)3Last N days
Date2026-04-01Since that date
Datetime2026-04-01 11:00Since that datetime

Additional flags

  • --compare — show current period vs previous period of same length

Example: --compare week shows this week vs last week.

Output

The script prints a summary to stdout and saves a detailed report to:

~/.claude/token-usage-reports/token_report.md

Cost Estimation

Prices are per million tokens, detected automatically per model:

ModelInputCache CreateCache ReadOutput
Opus$15.00$18.75$1.50$75.00
Sonnet$3.00$3.75$0.30$15.00
Haiku$0.80$1.00$0.08$4.00

The analyzer reads the model field from each assistant message and applies correct pricing automatically.

What the Report Includes

  1. Grand totals — tokens, estimated cost, session count
  2. Model breakdown — cost split by opus/sonnet/haiku with percentages
  3. Per-project breakdown — tokens, cost, subagent count per project
  4. Period comparison — current vs previous period (with --compare)
  5. Most costly sessions — ranked by estimated cost with first prompt preview

Tips for Reducing Usage

  • Cache read is cheap ($1.50/M vs $15/M for input) — long conversations benefit from cache
  • Subagents are expensive — each spawns a fresh context. Use sparingly.
  • Review your costliest sessions — often one runaway session costs more than a week of normal work
  • Use specific time ranges to track daily/weekly spending patterns

Requirements

  • Python 3.8+
  • Claude Code (session files in ~/.claude/projects/)
  • No external dependencies (stdlib only)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.