Skip to main content
100%

Claude Code token usage analyzer - breaks down usage by project, session, and subagent

✓ Published0🌍 Public
CChrisb4
Last edited Apr 6, 2026
Created on Apr 8, 2026

This visualization analyzes token usage from Claude Code’s local project logs, stored as JSONL files in `~/.claude/projects/`, and breaks down consumption by project, session, and subagent. The Python script (using `json`, `pathlib`, and `collections.defaultdict`) parses assistant and user messages, tallying `input_tokens`, `cache_creation_input_tokens`, `cache_read_input_tokens`, and `output_tokens` from the `usage` field. It recursively processes subagent session files in a `subagents` subdirectory, identifying human prompts by filtering out tool results and sidechain entries. The output is a structured dataset showing total tokens per session and project, suitable for further charting.

AI-generated description

Similar vizzes