Skip to content

huangcd/gcusage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

gcusage

πŸ“Š AI coding agent usage tracker β€” analyze token usage and costs from local data.

Supports GitHub Copilot CLI and Claude Code. Inspired by ccusage (11.8k⭐). 100% offline, zero telemetry.

Features

  • πŸ“Š Daily/Monthly reports β€” token usage aggregated by date
  • πŸ’¬ Session breakdown β€” per-session details with repo, model, tools
  • πŸ€– Model analysis β€” cost distribution across models with visual share bars
  • πŸ’° Cost estimation β€” based on known model pricing
  • πŸ”’ 100% offline β€” reads only ~/.copilot/ and ~/.claude/ local data, never sends anything externally
  • πŸ“‹ JSON export β€” --json flag for scripting and automation
  • πŸ”€ Multi-provider β€” unified view across Copilot CLI and Claude Code

Quick Start

# Run directly β€” no install needed
npx gcusage

# Or install globally
npm i -g gcusage
gcusage

Usage

gcusage              # Daily report β€” all providers (default)
gcusage daily        # Daily token usage and costs
gcusage monthly      # Monthly aggregated report
gcusage session      # Per-session breakdown
gcusage models       # Per-model usage distribution

Options

-p, --provider <p>   # Data source: copilot, claude, or all (default: all)
--since YYYYMMDD     # Filter sessions since date
--until YYYYMMDD     # Filter sessions until date
--json               # Output as JSON

Examples

# All providers β€” last 7 days
gcusage --since 20260317

# Claude Code only
gcusage -p claude

# Copilot only β€” March 2026 as JSON
gcusage monthly -p copilot --since 20260301 --until 20260331 --json

# Session details for this week
gcusage session --since 20260320

Sample Output

πŸ“Š GitHub Copilot CLI β€” Daily Usage Report

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Date       β”‚ Sessions β”‚ Output Tokens β”‚ Est. Input β”‚ Est. Cost β”‚  Tools β”‚ Models               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 2026-03-23 β”‚       45 β”‚        92,577 β”‚     32,911 β”‚     $7.31 β”‚    299 β”‚ claude-opus-4.6-1m   β”‚
β”‚ 2026-03-24 β”‚       19 β”‚       108,035 β”‚     10,381 β”‚     $8.26 β”‚    367 β”‚ claude-opus-4.6-1m   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Total      β”‚      701 β”‚     1,105,358 β”‚    460,275 β”‚    $35.04 β”‚ 14,053 β”‚                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Sources

gcusage reads from local data only β€” no network requests, ever.

GitHub Copilot CLI (~/.copilot/)

File Data
~/.copilot/session-state/<id>/events.jsonl Token counts, tool calls, model info
~/.copilot/session-state/<id>/workspace.yaml Session metadata (repo, branch, summary)
~/.copilot/config.json Current model selection

Claude Code (~/.claude/)

File Data
~/.claude/stats-cache.json Daily activity, per-model tokens, aggregate usage
~/.claude/history.jsonl Per-message history with session IDs, projects

Token Estimation

  • Copilot output tokens: Direct from assistant.message.data.outputTokens
  • Claude output tokens: From stats-cache.json daily model token aggregates
  • Input tokens: Estimated from user message content (~4 chars/token)
  • Cost: Calculated per-model using known pricing tables

Privacy

  • βœ… 100% offline β€” never connects to any external service
  • βœ… Read-only β€” only reads Copilot CLI and Claude Code local files
  • βœ… No telemetry β€” zero analytics, zero tracking, zero data collection
  • βœ… Open source β€” MIT license, audit the code yourself

Comparison

Tool ⭐ Copilot CLI Offline Language
gcusage new βœ… βœ… 100% TypeScript
ccusage 11.8k ❌ Claude only βœ… TypeScript
tokscale 1.3k ❌ ⚠️ leaderboard Rust
splitrail 134 βœ… ⚠️ cloud upload Rust
aidash 0 βœ… βœ… Rust

Development

git clone https://github.com/chongdihuang/gcusage
cd gcusage
npm install
npm run dev          # Run with tsx
npm run build        # Build with tsup
npm test             # Run tests

License

MIT Β© Chongdi Huang

About

πŸ“Š GitHub Copilot CLI and Claude Code usage tracker - analyze token usage and costs from local data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors