New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tokenking

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tokenking

Analyze Claude Code token usage for a specific project

latest
Source
npmnpm
Version
1.3.6
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

TokenKing

npm version npm downloads GitHub Release CI/Release Node.js Version License: MIT

A simple CLI tool that shows how much Claude Code usage a specific project has consumed.

What it does

Analyzes your Claude Code session history and shows aggregated statistics for a specific project:

  • Total sessions and date range
  • Token usage (input, output, cache creation/read)
  • Models used
  • Estimated costs in USD

Requirements

  • Node.js >= 18

Installation

# Install globally
npm install -g tokenking

# Or use with npx (no installation required)
npx tokenking ~/src/my-project

Usage

# Analyze current directory
tokenking .

# Analyze specific project
tokenking ~/src/my-project

# Show help
tokenking --help

# Show version
tokenking --version

# Or use with npx
npx tokenking ~/src/my-project

Example Output

📊 TokenKing Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Project: /path/to/my-project

Sessions: 12
First Session: 2025-10-15
Last Session: 2025-11-06
Date Range: 22 days

Total Tokens: 2,450,789
  Input: 1,234,567 tokens
  Output: 456,789 tokens
  Cache Create: 234,567 tokens
  Cache Read: 524,866 tokens

Models Used:
  • claude-sonnet-4-5-20250929
  • claude-haiku-4-5-20251001

Estimated Cost: $45.67 USD

How it works

TokenKing is built with TypeScript and uses ccusage as a dependency to read Claude Code session data. It loads all sessions, filters by project path (with support for moved directories via basename matching), then aggregates and displays the results.

Dependencies

  • ccusage - Reads Claude Code session data from ~/.claude/projects/
  • picocolors - Terminal colors for output formatting

Keywords

claude

FAQs

Package last updated on 07 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts