session-metrics

Analyze Claude Code JSONL logs to compute per-turn token usage and cost estimates.

9|Updated Apr 18, 2026
One-click install
npx skills add https://github.com/centminmod/claude-plugins --skill session-metrics-centminmod
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-metrics
Source: https://github.com/centminmod/claude-plugins/tree/main/plugins/session-metrics/skills/session-metrics
Command: npx skills add https://github.com/centminmod/claude-plugins --skill session-metrics-centminmod

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Tally Claude Code session token usage and cost estimates from the raw JSONL conversation log. Trigger when users ask about session cost, token usage, API spend, cache hit rate, input/output tokens, or wants a breakdown of per-turn metrics from the current or a past session.

Core Features & Use Cases

  • Provides per-turn and aggregate token usage and cost estimates across a session, along with cache read/write breakdowns.
  • Supports project-wide and instance-wide views to compare costs and usage across multiple sessions, exporting to JSON, CSV, MD, and HTML formats.
  • Enables quick prompts for session cost reports and enables post-export audit workflows without triggering post-export actions by default.

Quick Start

Run the skill to generate a per-turn cost and usage report for the active session.

Frequently Asked Questions about session-metrics

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

FAQPage Schema
How do I calculate token usage and cost estimates from Claude Code JSONL logs?

To calculate token usage and cost estimates from Claude Code JSONL logs, analyze the raw conversation files to compute per-turn metrics, cache reads, and aggregate session totals. This process extracts token breakdowns and applies pricing to generate structured cost reports.

Can I track per-turn API spend and cache hit rate for a specific Claude Code project?

Yes, you can track per-turn API spend and cache hit rate for a specific Claude Code project. By analyzing the JSONL conversation logs, the system computes per-turn token usage, cache read/write breakdowns, and estimated costs across all sessions within that project.

What is the best way to export Claude Code session metrics into a dashboard format?

The best way to export Claude Code session metrics into a dashboard format is to process the JSONL logs and output the aggregated token and cost data as JSON, CSV, Markdown, or HTML files. These structured outputs are suitable for direct dashboard integration.

Does generating a session cost report trigger any post-export actions or scripts?

No, generating a session cost report does not trigger post-export actions by default. The skill focuses on computing token usage and estimated costs from JSONL logs, enabling post-export audit workflows without executing any subsequent automated actions.

How are subagent token attributions handled when computing aggregate session metrics?

Subagent token attributions are optionally included when computing aggregate session metrics from JSONL logs. The analysis surfaces per-turn costs, per-model usage, and specific subagent attributions alongside the total session token breakdown and cache metrics.