Skip to content
mith2021Public

About

Stop typing /usage or opening a claude.ai tab — see your live Claude session limits right where you're working

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

cc-usage

Stop typing /usage. Stop opening a claude.ai tab just to check a percentage.

CI License: MIT Node ≥18 Zero dependencies

cc-usage terminal output

You know the loop: you're mid-task, you want to know how close you are to your session limit, so you either interrupt Claude Code to run /usage, or you alt-tab out, open a browser, find the right tab, click your profile, click Usage, squint at a percentage, and close it again. Every single time you want a number that should take zero seconds to check.

cc-usage puts that number where you already are. One command in the terminal — the same Current session, Weekly (7 day), and per-model limit bars as claude.ai's Usage page, with reset countdowns, no tab, no /usage, no context switch. Or skip the command entirely: the overlay widget sits on top of your editor as a small always-visible card and updates itself, so the answer is just there — not something you have to go ask for.

It piggybacks on your existing Claude Code login, so there is zero configuration: if claude works on your machine, cc-usage works.

  • 🚫 No tab, no /usage — the whole reason this exists
  • ⚡ Fast — one command, zero config, zero runtime dependencies
  • 📊 Complete — every limit bar Anthropic reports, not just the 5-hour window
  • 🔍 Local breakdown — what's eating your limits (big contexts, long-running sessions, subagents, skills, MCP), computed from your own transcripts, never sent anywhere
  • 📺 Always visible — the overlay widget turns it into an always-on-top desktop card (Windows) so you never have to ask again
  • 🤖 Scriptable — --json for status lines, scripts, and automations

Not a billing/token-analytics suite (see ccusage for that) — this tool has one job: get you your live session % without breaking your flow.

How it compares

cc-usage ccusage claude-monitor statusline
Live limit % (like /usage) ✅ ❌ ✅ ✅
"What's contributing" breakdown ✅ ❌ ❌ ❌
Per-model weekly limits ✅ ❌ ❌ ✅
Cost/billing analytics ❌ (by design) ✅ ✅ ❌
Runtime Node ≥18, 0 deps Node Python 3.9+ bash + jq + curl
Zero config ✅ ✅ ⚠️ ⚠️ manual install

Install

npm install -g cc-usage

Or run it without installing:

npx cc-usage

Requires Node.js ≥ 18 and a machine where you've logged into Claude Code at least once.

Usage

$ cc-usage

  Claude usage · Pro plan

  Current session  ██████░░░░░░░░░░░░░░░░░░    23%  resets in 4h 31m
  Weekly (7 day)   ███░░░░░░░░░░░░░░░░░░░░░    14%  resets in 3d 22h
  Weekly Fable     ██░░░░░░░░░░░░░░░░░░░░░░     8%  resets in 3d 22h

  What's contributing to your limits usage
  Approximate, based on local sessions on this machine — does not include other devices or claude.ai
  Last 24h (use --week for 7d) · independent characteristics of the same usage — they can overlap and don't sum to 100

  Usage from subagent-heavy sessions    23.4%
  Usage at >150k context                74.2%

  Skills
    context-save   3.1%
    spec           1.2%

  Subagents
    general-purpose    12.0%

  MCP servers
    claude_ai_Gmail   2.7%

Bars are color-coded: green under 50%, yellow 50–79%, red at 80%+. Every rate-limit window Anthropic reports for your account gets a bar — including per-model weekly limits ("Weekly Fable", "Weekly Opus", …) when your plan has them. If extra usage (pay-per-use overflow) is enabled on your account, its status is shown too.

The breakdown section is computed locally from your Claude Code session transcripts (~/.claude/projects/**/*.jsonl) — the same local data Claude Code's own /usage panel uses. It is approximate, covers only this machine, and never leaves it. All metrics are token-weighted: a message's weight is its total token consumption (input + output + cache read + cache creation) in the window. The two headline stats are independent characteristics of the same usage — a session can be both subagent-heavy (≥20% sidechain tokens) and running at >150k context — so they can overlap and don't sum to 100. Skill/MCP shares are attributed per invocation (the token weight of the assistant message that actually called the tool), not per session. If no skills, subagents, or MCP servers appear in the window, an explicit "none observed" line is shown rather than fabricated numbers.

JSON output (for scripting)

$ cc-usage --json
{
  "plan": "pro",
  "rate_limit_tier": "default_claude_ai",
  "limits": [
    { "kind": "session", "label": "Current session", "utilization": 23, "resets_at": "2026-07-03T00:20:00.000Z" },
    { "kind": "weekly_all", "label": "Weekly (7 day)", "utilization": 14, "resets_at": "2026-07-06T18:00:00.000Z" },
    { "kind": "weekly_scoped", "label": "Weekly Fable", "utilization": 8, "resets_at": "2026-07-06T18:00:00.000Z" }
  ],
  "extra_usage": null,
  "breakdown": {
    "window": "day",
    "large_context_pct": 74.2,
    "subagent_heavy_pct": 23.4,
    "skills": { "context-save": 3.1, "spec": 1.2 },
    "subagents": { "general-purpose": 12.0 },
    "mcp_servers": { "claude_ai_Gmail": 2.7 }
  }
}

Always-on-top overlay (Windows) — never ask again

The old --watch terminal mode has been replaced by a native Windows desktop overlay: a small, borderless, always-on-top "picture-in-picture" card that sits on top of your editor/terminal while you work and refreshes itself in the background. This is the fully hands-off version of the pitch above — you don't run a command, you don't check a tab, the number is just on your screen. See overlay/README.md for build/run instructions.

All options

Flag Description
--week Compute the local breakdown over the last 7 days (default: last 24 hours)
--json Machine-readable JSON output
--debug-raw Dump the raw API response to stderr (useful when reporting bugs)
-h, --help Show help
-v, --version Show version

How it works

Claude Code stores an OAuth token at ~/.claude/.credentials.json after you log in. cc-usage reads that file (read-only, locally) and calls the same Anthropic usage endpoint the official tooling uses. The token is never sent anywhere except api.anthropic.com.

The breakdown section makes no network calls: it reads your local Claude Code transcript logs read-only and prints only aggregate percentages and skill/subagent/MCP-server names — never prompts or project paths.

If your Claude config lives somewhere non-standard, set CLAUDE_CONFIG_DIR — the same environment variable Claude Code itself respects.

⚠️ Disclaimer: undocumented endpoint

This tool relies on an undocumented, reverse-engineered Anthropic endpoint (https://api.anthropic.com/api/oauth/usage). It is not a public API, and Anthropic may change or remove it at any time, without notice. If that happens, cc-usage will print a clear error instead of usage data until the tool is updated. Use accordingly — and please open an issue (attach --debug-raw output, minus anything sensitive) if you see the "unexpected data" error.

This project is not affiliated with or endorsed by Anthropic.

Scope (v0.6)

Supported:

  • claude.ai subscription accounts (Pro / Max / Team) logged in via Claude Code
  • All rate-limit windows the API reports, including per-model weekly limits
  • Local usage breakdown (subagent-heavy session %, large-context %, skills / subagents / MCP servers), token-weighted, day or week window
  • Always-on-top desktop overlay widget (Windows, see overlay/)

Not supported (by design):

  • API-key / Console usage tracking (different data source, different auth)
  • Token cost / billing analytics — use ccusage

Note: --watch/--interval (terminal live-refresh) were removed in v0.5 in favor of the native overlay widget. Plain cc-usage and cc-usage --json are unaffected.

Development

npm install
npm run build     # compile TypeScript to dist/
node bin/cli.js   # run locally
npm run lint
npm run typecheck

License

MIT

About

Stop typing /usage or opening a claude.ai tab — see your live Claude session limits right where you're working

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages