Recommended - always include @latest
<div align="center"> <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/logo.svg" alt="ccusage logo" width="256" height="256"> <h1>@ccusage/pi</h1> </div>
Overview
Analyze pi-agent session usage with the same reporting experience as <code>ccusage</code>.
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
Recommended: 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-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
--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
<p align="center"> <a href="https://www.youtube.com/watch?v=Ak6qpQ5qdgk"> <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/ccusage_thumbnail.png" alt="ccusage: The Claude Code cost scorecard that went viral" width="600"> </a> </p> <p align="center"> <a href="https://github.com/sponsors/ryoppippi"> <img src="https://cdn.jsdelivr.net/gh/ryoppippi/sponsors@main/sponsors.svg"> </a> </p>License
MIT © @ryoppippi