ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 mohammed-alsalhi

usage-band

一個 Claude Code 外掛,在提示列上方繪製狀態帶,顯示每個速率限制視窗(5h、week、per-model week)的圖表,以及上次重設後的花費。

mohammed-alsalhi@mohammed-alsalhi

mohammed-alsalhi/usage-band

已翻譯

關於這個 mod

usage-band 是一個 Claude Code 外掛(hooks 模組),會在提示列上方繪製狀態帶。它顯示 5h 視窗、每週視窗與依模型劃分的每週視窗之速率限制環,也顯示工作階段、每日和每月花費。每個環的外弧表示已使用百分比,內圈表示視窗已經過多少時間,並依使用量以綠色、琥珀色或紅色著色。每個環旁會顯示百分比、視窗標籤、重設時間和使用量圖表(SVG;在終端機中則是文字迷你圖)。將它複製到 ~/.claude/mods,讓 ~/.claude/settings.json 中的 CLAUDE_CODE_PLUGIN_DIRS 指向該資料夾,並啟用 CLAUDE_CODE_PLUGIN_DIR_WATCH。它從工作階段和帳戶使用量端點讀取使用量;憑證由引擎持有。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add mohammed-alsalhi/usage-band
claude plugin install usage-band
原文 / README

usage-band

A band above the Claude Code prompt that shows your rate limits and spend, built as a Claude Code plugin (a hooks module).

(ring)  3%  5h            · resets 4h31m  [graph]            (ring) 32%  7d        · resets 4d7h  [graph]
($)  $2.99  $12.08 today  · $12.08 mo                        (ring) 11%  7d fable  · resets 4d7h  [graph]

Layout

The band is two groups. The 5h window and the cost sit on the left; the weekly windows (7d and each per-model weekly, such as 7d fable) are pinned to the right edge.

Within a group, every field is its own column, so they line up down the rows whatever the text widths: rings, then percentages (right-aligned, so 3% sits under the 9 of $2.99), then labels (5h, 7d, $12.08 today), then reset times, then graphs. The cost row shares those columns.

The space between the two groups is left free, so more can be added in the middle.

If the window is too narrow for both groups side by side, they stack into one group, so all four rows share the same columns instead of each group lining up on its own, with the cost row last.

The rings

Each rate-limit ring has two parts: the outer ring is how much of the limit you have used, and the inner pie is how much of the window has gone by since its last reset. If the ring is further round than the pie, you are burning faster than time is passing.

| | | | --- | --- | | <img src="docs/ring-ahead.svg" width="40" alt="Outer ring about an eighth full, inner pie about 40% full"> | Ahead of pace. 12% used, 40% of the window gone. Green below 70%. | | <img src="docs/ring-behind.svg" width="40" alt="Outer ring three-quarters full in amber, inner pie almost full"> | Close to the line. 75% used, 95% of the window gone. Amber from 70%. | | <img src="docs/ring-over.svg" width="40" alt="Outer ring almost full in red, inner pie half full"> | Burning too fast. 95% used, only half the window gone. Red from 90%. | | <img src="docs/ring-cost.svg" width="40" alt="Full green ring with a dollar sign"> | Cost. This session's spend, then today and this month. No window, so no pie. |

Beside each ring: the percent used, the window (5h, 7d, or a per-model weekly such as 7d fable), when it resets, and a line graph of usage since the reset. The graph spans the whole window, so where the line stops is how far in you are. In a terminal, which can't draw SVG, the graph is text instead: one cell per slice of the window, ▁▂▃▄▅▆▇█ by usage and · where the slice is still ahead.

Install

git clone https://github.com/mohammed-alsalhi/usage-band ~/.claude/mods/usage-band

Point Claude Code at the folder in ~/.claude/settings.json, and set the watch flag so a running session reloads the mod when you save it:

{
  "env": {
    "CLAUDE_CODE_PLUGIN_DIRS": "~/.claude/mods/usage-band",
    "CLAUDE_CODE_PLUGIN_DIR_WATCH": "1"
  }
}

Then start a new session. The mod needs a Claude Code build with the plugin hooks API (2.1.286 here).

How it works

  • Readings come from the session's own usage plus the account usage endpoint, which is where the per-model weekly limits live. The engine holds the credential; the mod never sees the token.
  • Readings and spend are kept in the plugin store, shared by every session, so graphs and the today/month totals carry across sessions. Spend is counted once per session however often it is measured.
  • The rings are plain SVG built in hooks/register.tsx. The files in docs/ are samples made with the same code.

Develop

claude plugin validate .
claude plugin test .

其他同名作品

更多類似作品