Pi-agent usage tracking - unified Claude Max usage across Claude Code and pi-agent
npm install @ccusage/pi> Analyze pi-agent session usage with the same reporting experience as ccusage.
``bashRecommended - always include @latest
npx @ccusage/pi@latest --help
bunx @ccusage/pi@latest --help
$3
Since
npx @ccusage/pi@latest is quite long to type repeatedly, we strongly recommend setting up a shell alias:`bash
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
`bash
Daily usage grouped by date (default command)
npx @ccusage/pi@latest dailyMonthly usage grouped by month
npx @ccusage/pi@latest monthlySession-based usage
npx @ccusage/pi@latest sessionJSON output for scripting
npx @ccusage/pi@latest daily --jsonCustom pi-agent path
npx @ccusage/pi@latest daily --pi-path /path/to/sessionsFilter 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
- 📄 JSON Output: Export data in structured JSON format with
--json
- 📱 Compact Mode: Use --compact flag for narrow terminalsData Source
Pi-agent session data is read from:
| Directory | Default Path |
| ----------------- | ----------------------- |
| Pi-agent sessions |
~/.pi/agent/sessions/` |For detailed guides and examples, visit ccusage.com.
Check out ccusage: The Claude Code cost scorecard that went viral
MIT © @ryoppippi