|
| 1 | +<div align="center"> |
| 2 | + <img src="https://cdn.jsdelivr.net/gh/ryoppippi/ccusage@main/docs/public/logo.svg" alt="ccusage logo" width="256" height="256"> |
| 3 | + <h1>@ccusage/copilot</h1> |
| 4 | +</div> |
| 5 | + |
| 6 | +<p align="center"> |
| 7 | + <a href="https://socket.dev/api/npm/package/@ccusage/copilot"><img src="https://socket.dev/api/badge/npm/package/@ccusage/copilot" alt="Socket Badge" /></a> |
| 8 | + <a href="https://npmjs.com/package/@ccusage/copilot"><img src="https://img.shields.io/npm/v/@ccusage/copilot?color=yellow" alt="npm version" /></a> |
| 9 | + <a href="https://packagephobia.com/result?p=@ccusage/copilot"><img src="https://packagephobia.com/badge?p=@ccusage/copilot" alt="install size" /></a> |
| 10 | + <a href="https://deepwiki.com/ryoppippi/ccusage"><img src="https://img.shields.io/badge/DeepWiki-ryoppippi%2Fccusage-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==" alt="DeepWiki"></a> |
| 11 | +</p> |
| 12 | + |
| 13 | +> Analyze [GitHub Copilot CLI](https://docs.github.com/en/copilot/github-copilot-in-the-cli) usage logs with the same reporting experience as `ccusage`. |
| 14 | +
|
| 15 | +## Quick Start |
| 16 | + |
| 17 | +```bash |
| 18 | +# Recommended - always include @latest |
| 19 | +npx @ccusage/copilot@latest --help |
| 20 | +bunx @ccusage/copilot@latest --help # ⚠️ MUST include @latest with bunx |
| 21 | + |
| 22 | +# Alternative package runners |
| 23 | +pnpm dlx @ccusage/copilot |
| 24 | +pnpx @ccusage/copilot |
| 25 | +``` |
| 26 | + |
| 27 | +### Recommended: Shell Alias |
| 28 | + |
| 29 | +Since `npx @ccusage/copilot@latest` is quite long to type repeatedly, we strongly recommend setting up a shell alias: |
| 30 | + |
| 31 | +```bash |
| 32 | +# bash/zsh: alias ccusage-copilot='bunx @ccusage/copilot@latest' |
| 33 | +# fish: alias ccusage-copilot 'bunx @ccusage/copilot@latest' |
| 34 | + |
| 35 | +# Then simply run: |
| 36 | +ccusage-copilot daily |
| 37 | +ccusage-copilot monthly --json |
| 38 | +``` |
| 39 | + |
| 40 | +## Usage |
| 41 | + |
| 42 | +```bash |
| 43 | +# Daily usage report (default command) |
| 44 | +ccusage-copilot daily |
| 45 | + |
| 46 | +# Monthly summary |
| 47 | +ccusage-copilot monthly |
| 48 | + |
| 49 | +# Per-session breakdown |
| 50 | +ccusage-copilot session |
| 51 | + |
| 52 | +# JSON output |
| 53 | +ccusage-copilot daily --json |
| 54 | + |
| 55 | +# Compact table for narrow terminals |
| 56 | +ccusage-copilot daily --compact |
| 57 | + |
| 58 | +# Filter by date range |
| 59 | +ccusage-copilot daily --since 2026-04-01 --until 2026-04-30 |
| 60 | + |
| 61 | +# Reverse sort order |
| 62 | +ccusage-copilot daily --order desc |
| 63 | + |
| 64 | +# Show per-model breakdown |
| 65 | +ccusage-copilot daily --breakdown --mode api |
| 66 | + |
| 67 | +# Use specific timezone |
| 68 | +ccusage-copilot daily --timezone America/New_York |
| 69 | + |
| 70 | +# Use cached pricing (offline) |
| 71 | +ccusage-copilot daily --mode api --offline |
| 72 | +``` |
| 73 | + |
| 74 | +## Pricing Modes |
| 75 | + |
| 76 | +Use `--mode` to control how costs are calculated: |
| 77 | + |
| 78 | +```bash |
| 79 | +# Premium request pricing (default) — what you actually pay on Copilot |
| 80 | +ccusage-copilot daily --mode premium |
| 81 | + |
| 82 | +# API-equivalent pricing — what it would cost at Anthropic/OpenAI API rates |
| 83 | +ccusage-copilot daily --mode api |
| 84 | +``` |
| 85 | + |
| 86 | +- **`premium`** (default): Uses GitHub Copilot's premium request counts × $0.04 (overage rate). The `requests.cost` field already includes model multipliers. |
| 87 | +- **`api`**: Calculates hypothetical costs using official Anthropic/OpenAI API rates via LiteLLM. Useful for understanding the value of your Copilot subscription. |
| 88 | + |
| 89 | +JSON output always includes both `premiumCostUSD` and `apiCostUSD` regardless of selected mode. |
| 90 | + |
| 91 | +## Data Source |
| 92 | + |
| 93 | +Copilot CLI stores session data at: |
| 94 | + |
| 95 | +```text |
| 96 | +~/.copilot/ |
| 97 | + session-state/ |
| 98 | + {sessionId}/ # UUID directory per session |
| 99 | + events.jsonl # JSON Lines event stream |
| 100 | + workspace.yaml # session metadata |
| 101 | +``` |
| 102 | + |
| 103 | +## Environment Variables |
| 104 | + |
| 105 | +- `COPILOT_CONFIG_DIR` — override the base Copilot directory (default: `~/.copilot`) |
| 106 | +- `LOG_LEVEL` — control logging verbosity (0=silent … 5=trace) |
| 107 | + |
| 108 | +## Related |
| 109 | + |
| 110 | +Part of the [ccusage](https://github.com/ryoppippi/ccusage) family: |
| 111 | + |
| 112 | +- [`ccusage`](https://www.npmjs.com/package/ccusage) — Claude Code usage |
| 113 | +- [`@ccusage/codex`](https://www.npmjs.com/package/@ccusage/codex) — OpenAI Codex usage |
| 114 | +- [`@ccusage/opencode`](https://www.npmjs.com/package/@ccusage/opencode) — OpenCode usage |
| 115 | +- [`@ccusage/pi`](https://www.npmjs.com/package/@ccusage/pi) — Pi-agent usage |
| 116 | +- [`@ccusage/amp`](https://www.npmjs.com/package/@ccusage/amp) — Amp usage |
| 117 | +- [`@ccusage/copilot`](https://www.npmjs.com/package/@ccusage/copilot) — GitHub Copilot CLI usage |
0 commit comments