ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 KhadeerBasha1232

usage-band

Claude Code 插件在提示列上方用一行显示套餐用量、限制、上下文窗口、模型和工作会话成本,并提供重置时间、速度警告、限制提醒和紧凑按钮。

KhadeerBasha1232@KhadeerBasha1232

KhadeerBasha1232/claude-usage-mod/tree/main/plugins/usage-band

原帖图片1
已翻译

关于这个 mod

始终可见的 Claude 套餐用量:Claude Code 中提示列正上方的一行状态带,显示 5 小时工作会话限制、带重置时间的每周限制、以 token 计的上下文窗口占用率,以及按 API 价格计算的当前模型和工作会话成本。它还会在你消耗限制的速度超过窗口经过速度时发出警告,在达到 80% 和 95% 以及重置时弹出提醒,并在上下文超过 70% 后加入 Compact 按钮。每个数值都有小型进度环,达到 70% 时变黄,达到 90% 时变红;状态带每 15 秒实时更新一次,并在每个步骤或回复后更新。可在 macOS 和 Windows 的 Claude 桌面应用(Code 标签)及终端中运行,需要 Claude Code v2.1.286 或更高版本,只读取本地文件,不发起网络请求。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add KhadeerBasha1232/claude-usage-mod
claude plugin install usage-band
原文 / README

claude-usage-mod

Your Claude plan usage, always visible: a one-line band directly above the prompt in Claude Code.

The usage band above the prompt in the Claude desktop app

◔ 5h 72% ⚠ resets 1:19 PM  │  ◑ Week 50% resets Sat 2:30 PM  │  ○ Context 40% 404k / 1M  │  Opus 5.5 · $13.24 (+$0.41)
  • 5h: your 5-hour session limit, with the time it resets
  • Week: your weekly limit, with its reset time
  • Context: how full this chat's context window is, in tokens
  • Model and this session's cost at API prices, with what the last reply added (you aren't charged this on a Pro/Max plan)

It also helps you stay ahead of your limits:

  • Pace warning ⚠: shown next to a limit you're using faster than its window is passing, so you know you'll run out before it resets.
  • Limit alerts: a pop-up when the 5-hour or weekly limit reaches 80% and 95%, and when it resets. Each shows once.
  • Compact button: appears in the band once the context window is over 70% full. Click it to compact the conversation.

Each of these can be turned off in Settings.

Each figure has a small progress ring (pie glyphs ○ ◔ ◑ ◕ ● in the terminal) that turns yellow at 70% and red at 90%. The band updates live: every 15 seconds, after each step Claude takes, and after every reply. It always stays on one line: in a narrow window it shortens the reset times to ↻ 1:19 PM, then drops the token count, then the model. The cost always stays.

Works in the Claude desktop app (Code tab) on macOS and Windows, and in claude in the terminal.

Install

In a Claude Code chat:

/plugin marketplace add KhadeerBasha1232/claude-usage-mod
/plugin install usage-band@claude-usage-mod

Then fully quit and reopen Claude (in the terminal, /reload-plugins is enough). In a new chat the band appears after your first message, once Claude Code has started.

Or from your shell:

claude plugin marketplace add KhadeerBasha1232/claude-usage-mod
claude plugin install usage-band@claude-usage-mod

Requires Claude Code with mod support (v2.1.286 or later).

Tip: turn on auto-update so you get new versions without doing anything.

Where the numbers come from

| Figure | Source | |---|---| | 5h / Week | Claude Code's own rate-limit figures, which give exact reset times. Claude Code only reports them in some sessions, and only after a reply, so the band saves the last exact figures and every chat on your computer reuses them. Until it has seen exact figures once, it falls back to the usage history the Claude desktop app keeps on your computer (plan-usage-history.json). | | Context, model, cost | Claude Code's session figures |

Saved reset times stay exact: the weekly one rolls on a week at a time, and the percentage always comes from the newest reading. Only when the band has never seen exact figures are the reset times worked out from the app's history, marked with ~:

  • 5-hour reset: five hours from when the current window started filling (usually within a few minutes of the real time).
  • Weekly reset: detected from when your weekly figure dropped back down. The app only records usage while it's open, so a reset is often only noticed hours or days later. The band shows a detected time only once it can pin it down to within about 3 hours (it gets better as more weeks of history build up). Until then the weekly figure shows without a time. For an exact time from day one, set weekly_reset (below).

The band only reads local files. It makes no network requests and never touches your credentials.

Settings

| Option | What it does | |---|---| | weekly_reset | Recommended. Your weekly limit's reset time in local time, e.g. Sat 14:30 or Saturday 2:30 PM. You can find it in Claude Settings → Usage. Leave empty to detect it automatically. | | alerts | Pop-ups at 80% and 95% and when a limit resets. On by default. | | pace | The ⚠ pace warning. On by default. | | compact_button | The Compact button once the context is over 70% full. On by default. | | reply_cost | The last reply's cost next to the session cost. On by default. |

Set it with:

/plugin configure usage-band@claude-usage-mod

Update

Turn on auto-update (recommended)

Claude Code doesn't auto-update third-party marketplaces unless you ask it to. Turn it on once and you'll get new versions by yourself:

  1. In a Claude Code chat, run /plugin.
  2. Go to the Marketplaces tab and select claude-usage-mod.
  3. Select Enable auto-update.

In the desktop app, use the same /plugin command in a Code tab chat.

Or add "autoUpdate": true to the marketplace's entry in ~/.claude/settings.json:

"extraKnownMarketplaces": {
  "claude-usage-mod": {
    "source": { "source": "github", "repo": "KhadeerBasha1232/claude-usage-mod" },
    "autoUpdate": true
  }
}

With auto-update on, Claude Code checks for a new version a few minutes after your first message in a chat. When it finds one, it shows Plugin updated: usage-band · Run /reload-plugins to apply, and your next chat loads it.

Update by hand

/plugin marketplace update claude-usage-mod

Uninstall

/plugin uninstall usage-band@claude-usage-mod

Development

claude plugin validate --strict plugins/usage-band
claude plugin test plugins/usage-band

To try changes live, run claude --plugin-dir plugins/usage-band. Saving a file reloads the mod.

License

MIT

其他同名作品

更多类似作品