@ccusage/pi
v18.0.5
Published
Pi-agent usage tracking - unified Claude Max usage across Claude Code and pi-agent
Readme
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/piRecommended: Shell Alias
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 viaPI_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-19Useful 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
- 📄 JSON Output: Export data in structured JSON format with
--json - 📱 Compact Mode: Use
--compactflag for narrow terminals
Data Source
Pi-agent session data is read from:
| Directory | Default Path |
| ----------------- | ----------------------- |
| Pi-agent sessions | ~/.pi/agent/sessions/ |
Documentation
For detailed guides and examples, visit ccusage.com.
Sponsors
Featured Sponsor
Check out ccusage: The Claude Code cost scorecard that went viral
License
MIT © @ryoppippi
