claude-code-token-usage

Parse Claude Code session data to compute per-project token usage and costs.

9|2|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/DavidTeju/shared-skills --skill claude-code-token-usage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-code-token-usage
Source: https://github.com/DavidTeju/shared-skills/tree/main/skills/claude-code-token-usage
Command: npx skills add https://github.com/DavidTeju/shared-skills --skill claude-code-token-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Calculates project-specific token usage and estimated costs from Claude Code session data. Use when you want to understand token spending per project, track costs, and compare usage across projects.

Core Features & Use Cases

  • Parse session data from ~/.claude and project-specific JSONL transcripts to accumulate per-message token usage.
  • Compute project-level token counts (input, output) and cache-related tokens from prompt caching.
  • Estimate costs with configurable pricing and provide cross-project comparisons for optimization.

Quick Start

Run the included script to compute token usage and project costs for a given Claude Code project.

Frequently Asked Questions about claude-code-token-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate token usage and costs for Claude Code projects?

You can calculate token usage and costs by parsing session data from ~/.claude/stats-cache.json and project-specific JSONL transcripts to accumulate per-message token counts and estimate pricing.

What is the best way to track Claude Code spending across multiple projects?

The best way to track spending is by computing project-level token counts and comparing estimated costs across projects using configurable pricing applied to parsed session data.

Does Claude Code cost estimation include prompt caching tokens?

Yes, Claude Code cost estimation includes prompt caching tokens by parsing cache-related token usage from project JSONL transcripts to compute accurate project-level metrics.

Can I analyze JSONL session transcripts to explore my Claude Code usage patterns?

Yes, you can analyze JSONL session transcripts stored in ~/.claude/projects to explore usage patterns by accumulating per-message token usage and computing project-level metrics.

How do I configure pricing for Claude Code token cost estimation?

You can configure pricing for Claude Code token cost estimation by adjusting the pricing parameters used to compute costs from the parsed input and output token counts.

What Claude Code session data is needed to compute per-project token metrics?

You need the ~/.claude/stats-cache.json file and the JSONL transcripts located in ~/.claude/projects/{project-path} to parse and compute per-project token metrics and costs.