arafathusayn/cc-mods/tree/main/mods/usage-meter
usage-meter
在提示列上方的一行顯示方案的 5 小時與每週用量上限,以及距離每次重設的時間;`/usage-meter` 會開啟面板,顯示你的使用速度和何時會用完。
關於這個 mod
Claude Code 外掛,會把訂閱用量時段(5 小時、所有模型每週、每個模型每週)持續顯示在提示列上方的一行,並在 50% 與 75% 設定色彩門檻。/usage-meter 會切換詳細面板,顯示長條、重設時刻與倒數、近期使用速度,以及該時段會提前用完還是能維持到重設。5 小時與每週時段的資料來自每次回覆;每個模型的每週用量則從帳號用量要求讀取,每次回覆後最多每五分鐘讀取一次。透過 claude plugin marketplace add arafathusayn/cc-mods 和 claude plugin install usage-meter@cc-mods 安裝。已用 Claude Code 2.1.289 測試。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add arafathusayn/cc-mods claude plugin install usage-meter
原文 / README
usage-meter
Your Claude subscription has usage limits: a 5-hour window, a weekly window for all models, a
weekly window for a model your plan counts on its own (such as Fable) and, on a Claude gateway, a
spend limit. Claude Code mentions them only once you are close. usage-meter keeps them on screen
the whole session, as one line at the right side above the prompt:
5H 14% 2h 55m │ WK 76% 4d 0h │ Fable 30% 4d 0h
Each entry is a window: how much of it is used, and how long until it resets. A model's own week carries the model's name. The percent turns yellow from 50% and red from 75%. The line appears once Claude has replied for the first time in a subscription session; a session on an API key has no usage limits, so nothing is drawn.
/usage-meter opens a pane with more for each window: a bar drawn to the pane's width, the reset
as a clock time and a countdown, your recent pace, and where that pace leads:
5-hour limit · 14% used
█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
resets 15:00 (in 2h 55m)
pace 6.0%/h over the last 1h 0m
at this pace: lasts until the reset
Run /usage-meter again to close it.
Install
claude plugin marketplace add arafathusayn/cc-mods
claude plugin install usage-meter@cc-mods
Where the figures come from
- The 5-hour and the all-models weekly windows come with every reply: Claude Code passes them on
(
session.measure), so the meter asks nothing for them. - A model's own week is not in the replies. The meter reads it from your account's usage, the same
request
/usagemakes, at most every five minutes after a reply and every quarter hour while the session sits idle. It asks with the session's own login through Claude Code, which keeps the credential and sends it to Anthropic alone; the mod never sees it. A session without a Claude login (an API key, a gateway) asks nothing. - That request is the one Claude Code itself uses, not a published API. Should its answer change shape, the model weeks are left out and the rest of the meter carries on.
How the pace is worked out
- The meter keeps the moments a window's use changed, so the pace survives a restart inside the same window.
- The pace is the change in use over the last fifth of the window (an hour of the 5-hour window, a little under a day and a half of the weekly one), or over everything seen when that is shorter.
- No pace is quoted until the meter has watched a twentieth of the window (15 minutes of the 5-hour window, about 8.4 hours of the weekly one): use moves in steps of about a point, and one step over a few minutes would read as many times the real pace. Until then the pane says when it will know.
- Where the pace leads:
runs out in ~2h 5mwhen the window fills before it resets,lasts until the resetwhen the reset comes first,not risingwhen use has not moved. - A new window is recognised by a reset time that moved, a reset time that passed, or use that fell; the old window's history is dropped.
Develop
claude --plugin-dir mods/usage-meter
hooks/register.tsx is the only file that touches $: it builds the ports the use cases in
hooks/actions.ts run on and wires the events. The rest is pure: reading.ts and
account-usage.ts decode what the engine and the account's usage report, track.ts and
meter.ts keep the history, forecast.ts works out the pace, wording.ts writes the text,
band.tsx and pane.tsx draw.
Inspired by quota-meter from claude-mods (MIT); written anew here.
Tested with Claude Code 2.1.289.
其他同名作品
- usage-meterhamzafer · ★ 91
- usage-metermishgoldenberg · ★ 3
- usage-meterLeeHigma0201 · ★ 3
- usage-metereshin087 · ★ 0
- usage-meterPimzino · ★ 0
- usage-meter0xGondarxyz · ★ 0

