New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@unravel-tech/ccusage-pi

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unravel-tech/ccusage-pi

Pi-agent usage tracking - unified Claude Max usage across Claude Code and pi-agent

latest
Source
npmnpm
Version
18.2.2
Version published
Weekly downloads
2
100%
Maintainers
2
Weekly downloads
 
Created
Source
ccusage logo

@ccusage/pi

Socket Badge npm version NPM Downloads install size DeepWiki

Analyze pi-agent session usage with the same reporting experience as ccusage.

Quick Start

# Recommended - always include @latest
npx @ccusage/pi@latest --help
bunx @ccusage/pi@latest --help

# Alternative package runners
pnpm dlx @ccusage/pi
pnpx @ccusage/pi

Since npx @ccusage/pi@latest is quite long to type repeatedly, we strongly recommend setting up a shell alias:

# bash/zsh: alias ccusage-pi='bunx @ccusage/pi@latest'
# fish:     alias ccusage-pi 'bunx @ccusage/pi@latest'

# Then simply run:
ccusage-pi daily
ccusage-pi monthly --json

💡 The CLI reads pi-agent session data from ~/.pi/agent/sessions/ (configurable via PI_AGENT_DIR).

Common Commands

# Daily usage grouped by date (default command)
npx @ccusage/pi@latest daily

# Monthly usage grouped by month
npx @ccusage/pi@latest monthly

# Session-based usage
npx @ccusage/pi@latest session

# JSON output for scripting
npx @ccusage/pi@latest daily --json

# Custom pi-agent path
npx @ccusage/pi@latest daily --pi-path /path/to/sessions

# Filter by date range
npx @ccusage/pi@latest daily --since 2025-12-01 --until 2025-12-19

Useful environment variables:

  • PI_AGENT_DIR – override the pi-agent sessions directory (defaults to ~/.pi/agent/sessions)
  • LOG_LEVEL – control log verbosity (0 silent … 5 trace)

What is pi-agent?

Pi-agent is an alternative Claude coding agent. It stores usage data in a similar JSONL format to Claude Code but in a different directory structure.

Features

  • 📊 Daily/Monthly/Session Reports: Same reporting options as ccusage
  • 💵 Accurate Cost Calculation: Uses LiteLLM pricing database
  • 🧠 Subagent-aware accounting: Usage totals include both top-level assistant usage and nested subagent usage from message.details.results[].usage where message.toolName == "subagent"
  • 📄 JSON Output: Export data in structured JSON format with --json
  • 📱 Compact Mode: Use --compact flag for narrow terminals

Data Source

Pi-agent session data is read from:

DirectoryDefault Path
Pi-agent sessions~/.pi/agent/sessions/

Documentation

For detailed guides and examples, visit ccusage.com.

Sponsors

Check out ccusage: The Claude Code cost scorecard that went viral

ccusage: The Claude Code cost scorecard that went viral

License

MIT © @ryoppippi

FAQs

Package last updated on 06 Mar 2026

Related posts