tokenfficiency
v0.1.7
Published
Compare your AI token usage to your shipping efficiency
Readme
tokenfficiency
Compare your AI token spend to the code you actually ship.
npx tokenfficiencyAuto-detects your coding agents, pulls your GitHub shipping stats, calculates efficiency metrics, and publishes a shareable report.
What it does
- GitHub stats via
ghCLI — merged PRs, direct commits, lines added/deleted per commit with file-level noise filtering (lock files, generated code, etc.) - Token usage via the ccusage family — Claude Code, OpenCode, Codex, Pi, Amp
- Efficiency grade (S through F) based on cost per line of shipped code
- Auto-publishes to tokenfficiency.vercel.app for a shareable link
Requirements
At least one of:
- GitHub CLI (
gh auth login) — for shipping stats - A coding agent (Claude Code, OpenCode, Codex, Pi, Amp) — for token usage
Options
--since <YYYYMMDD> Filter from date (default: 2026-01-01)
--until <YYYYMMDD> Filter until date
--repo <owner/repo> Filter to specific repo
--no-post Don't upload (local only)
--json Output as JSON (implies --no-post)
--help Show help
--version Show versionExamples
npx tokenfficiency # full report, auto-publish
npx tokenfficiency --no-post # local only
npx tokenfficiency --since 20260301 # March 2026 onwards
npx tokenfficiency --repo myorg/myapp # single repo
npx tokenfficiency --json | jq .efficiency # pipe to jqGrading
Based on cost per line of shipped code (after noise filtering):
| Grade | Cost/line | Description | |-------|-----------|-------------| | S | < $0.001 | Hyper-efficient | | A | < $0.005 | Excellent | | B | < $0.01 | Good | | C | < $0.05 | Average | | D | < $0.10 | Costly | | F | > $0.10 | Expensive |
How it works
- Shells out to
ghfor GitHub data (reuses your existing auth) - Shells out to
ccusage,@ccusage/opencode,@ccusage/codex,@ccusage/pi,@ccusage/ampfor token data - Filters noise files (lock files,
.min.js,.d.ts, vendored deps, etc.) at the file level using GitHub's per-file API - Excludes merge commits, reverts, and bot activity
- Maps token sessions to GitHub repos via local git remotes
- Publishes to tokenfficiency.vercel.app with GitHub token verification (you can only publish your own report)
