claude-quota

Claude Code statusline plugin · Node.js · MIT

Know you will run out before you run out.

See the 5-hour session, the 7-day window, Sonnet, Opus and extra usage in the statusline while you work, each with an arrow that says whether this pace gets you to the reset. The figures come from the same usage API the /usage page reads; Claude Code itself tells you about a quota only when you hit it.

This page describes claude-quota 0.3.1, which is not released yet; the newest download is 0.2.11. What you can install today

5quota windows in view: 5h, 7d, Sonnet, Opus, extra
1usage fetch shared by every open session
Three-line statusline: model and context on the first line, the 5-hour and Sonnet quotas on the second, the 7-day quota and extra usage on the third

A percentage alone does not say whether you are in trouble; 60 % used with 80 % of the window gone is fine, 60 % used with 20 % gone is not. The pace arrow does that arithmetic for you, on every refresh.

Pace, not just percentage

↗145% is where you land at reset at the current rate. Over 100 % means the quota runs out first. The clock glyph ○◔◑◕● shows how much of the window has elapsed.

Every bucket

The 5-hour session, the 7-day all-models window, the 7-day Sonnet and Opus windows, and extra usage with spent, pace, projected and the monthly limit.

Yellow and red only near the limit

Numbers stay small; the bar cells, the arrow and the money turn yellow and red on their own thresholds, and the cells the quota will never reach go grey.

Fits any terminal

Measured in columns, never wraps. Three lines on a normal terminal, two on a short one, model │ ctx% │ 5h% │ 7d% on one.

A live dashboard

Every render also writes an HTML dashboard beside its cache — one card per window with a pace gauge — and links it from line 1 on terminals with OSC 8 links.

How a render runs

Claude Code runs the plugin as a subprocess on every statusline refresh.

The HTML dashboard: one card per window with quota, elapsed time, a pace gauge and the reset time
The dashboard: the statusline's figures, one card per window, polled every five seconds.
  1. Context arrives on stdin

    Model, effort, context window and cwd, as JSON — the same payload every statusline command gets.

  2. The token is read

    From the macOS Keychain, or from ~/.claude/.credentials.json elsewhere if it is 0600 and yours. The same credential Claude Code uses; no login of its own.

  3. Usage is fetched or served from cache

    GET api.anthropic.com/api/oauth/usage, cached for two minutes. Before the cache runs out a background refresh starts, so a long session never shows stale numbers and never fetches on the hot path.

  4. One to three lines

    Rendered to stdout, sized to the terminal; the reset timer, then pace and projection, then the bar are dropped in that order until the line fits. The dashboard is rewritten beside the cache.

Install

On npm: 0.2.11 · 2026-04-16

Node.js 18 or newer, and a Pro or Max subscription: the usage API has nothing for API-key logins, so only the model and context line renders there.

This page describes claude-quota 0.3.1, which is not released yet; the newest download is 0.2.11.

npm has 0.2.11. It shows the same quotas and pace arrows described here; its HTML dashboard has an older card layout than the screenshot, and 0.3.x adds the Design, Routines and Code cards and fixes to how several Claude Code windows share one fetch.

From npm

npm install -g @mmdemirbas/claude-quota

Then point the statusline at it in ~/.claude/settings.json:

settings.json

{
  "statusLine": {
    "type": "command",
    "command": "claude-quota"
  }
}

If you use claude-hud, disable it first so the two do not share the line.

What you see

Each segment of the statusline and what it means.

SegmentMeaning
sonnet highModel family and effort level
ctx:██░░░░░░░░ 23%Context window: a 10-cell bar and the percentage
dashboardAn OSC 8 hyperlink to the HTML dashboard; plain text where links are unsupported
lakelab git:(main*)Project directory and branch; * means a dirty working tree
max 5xPlan name and multiplier
5h: 7d: snt: ops:The 5-hour session, the 7-day all-models window, the 7-day Sonnet and Opus windows
█████░░░░░ 31%Used share of the window
↗145% → 90% ↘ 74%Pace: the projected share at the end of the window; over 100 % means the quota runs out before it resets
◔3h56mTime until reset; the glyph is how much of the window has elapsed
⟳18:00Local time of the last successful fetch
●$: / ○$:Extra usage on or off
$0 ↘ $0 /$5Extra usage spent · pace · projected · monthly limit

Security model

The plugin reads a credential and writes files in your home directory, so each surface has a rule.

SurfaceRuleWhy
Credential sourceKeychain first; ~/.claude/.credentials.json as the fallback, refused unless 0600 and owned by youA token planted by another local user is never used
Cache filesdata.js, credit-grant.js, .profile-cache.json, dashboard.html under ~/.claude/plugins/claude-quota/, mode 0600; broader modes are refusedA second local user cannot feed the dashboard
Dashboard outputEvery externally sourced string is HTML-escapedA tampered API response cannot run script in the page
HTTPSSystem trust store, TLS 1.2 minimum, no certificate pinAnthropic rotates the leaf without a published pin set; a hardcoded pin would become an outage
StderrOne warning line for HTTP 401/403 and rejected files; rate limits and expiry stay silentCLAUDE_QUOTA_SILENT=1 disables all warnings