jimmyeao/claude-code-bars/tree/main/plugins/usage-bar
GitHub 儲存庫 · 發布者 jimmyeao
usage-bar
將方案用量限制繪製成提示列上方的長條圖,每個時間窗口使用一種顏色,並在用量增長速度超過時鐘進度時標示。使用 /usage-bar 切換。
jimmyeao@jimmyeao
關於這個 mod
usage-bar
將方案用量限制繪製成提示列上方的長條圖,並標示用量增長速度超過時鐘進度的時間窗口(示例輸出,不是真實資料):
Usage · amber = using a window faster than its clock · session $12.19
Session █████████████████████░░░░░ 79% used · 47% of time · 32 pts ahead of the clock · resets in 2h 40m
Week ███░░░░░░░░░░░░░░░░░░░░░░░ 10% used · 61% of time · resets in 2d 18h
- 每個限制窗口一條長條圖:引擎回報的窗口包括
Session(5 小時)、Week(7 天),以及閘道消費限制的Spend。顏色表示對應的窗口。實心部分是已使用的額度,陰影部分是剩餘額度。 % of time表示窗口已經過去的時間比例,根據它的重設時間計算。- 標示會比較列印出的兩個數字。領先超過 5 個百分點時,
% used變為琥珀色,並加入N pts ahead of the clock。領先超過 25 個百分點,或已使用 95% 以上時,變為紅色。沒有已知長度的窗口(消費限制)沒有時鐘,因此只有接近用滿時才會標示。 - 工作階段成本顯示在標題列中。
使用
/usage-bar 可以切換它。每個工作階段開始時預設開啟。
運作方式
- 讀取
$.session.usage():最近一次 API 回應中的速率限制窗口和工作階段成本。 - 每次提示和完成一輪後重新整理,並且每分鐘重新整理一次,讓倒數持續推進。
- 在
AbovePrompt區域繪製,位於其他也在該區域繪製的區段之上。顯示調查時會暫時讓開。
限制
- 只顯示引擎回報的窗口。沒有按模型拆分的列(例如僅 Sonnet),所以不會與
/usage的每一列都相符。 - 不使用訂閱方案時沒有可繪製的限制,並顯示 “No plan limits reported for this account.”
- 假定窗口長度為 5 小時和 7 天。如果窗口並非完全這麼長,
% of time只是近似值。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add jimmyeao/claude-code-bars claude plugin install usage-bar
原文 / README
usage-bar
Draws your plan usage limits as bars above the prompt, and flags a window you are using faster than its clock (illustrative output, not real figures):
Usage · amber = using a window faster than its clock · session $12.19
Session █████████████████████░░░░░ 79% used · 47% of time · 32 pts ahead of the clock · resets in 2h 40m
Week ███░░░░░░░░░░░░░░░░░░░░░░░ 10% used · 61% of time · resets in 2d 18h
- One bar per limit window the engine reports:
Session(5 hours),Week(7 days), andSpendfor a gateway spend limit. The colour says which window it is. The solid part is what you have used, the shaded part is what is left. % of timeis how much of the window has already passed, worked out from its reset time.- The flag compares the two printed numbers. More than 5 points ahead turns
% usedamber and addsN pts ahead of the clock. More than 25 points ahead, or 95% used or more, turns it red. A window with no known length (the spend limit) has no clock, so it is flagged only when nearly full. - Session cost appears in the header line.
Use
/usage-bar toggles it. It starts on in every session.
How it works
- Reads
$.session.usage(): the rate-limit windows from the last API response, and the session cost. - Refreshes after each prompt and finished turn, and once a minute so the countdowns keep moving.
- Draws in the
AbovePromptband, on top of whatever other band mods draw there. It steps aside while a survey is showing.
Limits
- It shows only the windows the engine reports. There are no per-model rows (for example Sonnet-only), so it will not match every line of
/usage. - Off a subscription plan there are no limits to draw, and it says "No plan limits reported for this account."
- The 5-hour and 7-day window lengths are assumed. If a window is not exactly that long,
% of timeis approximate.
