@bonjinnorenka/copilot-usage
v1.0.1
Published
Analyze GitHub Copilot CLI session usage and costs
Maintainers
Readme
@bonjinnorenka/copilot-usage
Analyze GitHub Copilot CLI session usage and costs.
Features
- Parses
~/.copilot/session-stateto extract per-session model metrics - Fetches model pricing data from litellm (cached for 24h)
- Calculates token costs for input, cache read/write, and output tokens
- Shows premium request counts and cost efficiency ratios
- Displays results in a responsive table with totals
Usage
npx @bonjinnorenka/copilot-usageOr install globally and run:
npm install -g @bonjinnorenka/copilot-usage
copilot-usageLocal development:
npm install
npm startOptions
| Option | Description |
| ------------ | -------------------------------------- |
| --full-id | Show full session IDs (default: 8 chars) |
| --path DIR | Specify custom session-state directory |
Example Output
┌──────────┬───────────┬──────────┬─────────────┬─────────────┬────────────┬─────────────┬──────────────┬────────────────┬───────┐
│Session ID│ Model │Timestamp │ Input Token │ CacheWrite │ CacheRead │Output Token │ Total Token │ Total Pricing │Cost │
├──────────┼───────────┼──────────┼─────────────┼─────────────┼────────────┼─────────────┼──────────────┼────────────────┼───────┤
│a1b2c3d… │gpt-4o │04/18 10:30│ 1,234 │ 0 │ 567 │ 890 │ 2,691 │ $0.0123 │ 5 │
└──────────┴───────────┴──────────┴─────────────┴─────────────┴────────────┴─────────────┴──────────────┴────────────────┴───────┘How It Works
- Reads session directories under
~/.copilot/session-state - Parses
events.jsonlfrom each session to extractsession.startandsession.shutdownevents - Computes per-model token usage and estimates cost using litellm pricing data
- Calculates Efficiency =
Total Pricing / (Cost × $0.04)— higher means more value per premium request
Acknowledgments
Inspired by ccusage.
License
MIT
