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

usage-tracker

Claude Code 外挂,在底部网格中加入一行,显示订阅方案以及工作阶段/每周用量窗口,并在达到阈值时显示通知。

Lunik@Lunik

Lunik/gmz-claude-marketplace/tree/master/usage-tracker

已翻译

关于这个 mod

usage-tracker 是一个 Claude Code 市场外挂,会在右下角网格中绘制一行,从 claude auth status 读取你的方案,并显示 5 小时工作阶段和 7 天每周用量条。每条用量条使用 10 个单元,在 80%/90% 处变为绿/橙/红;每次首次越过阈值时触发通知(重置后重新武装)。工作阶段会在每次模型请求后刷新;每周用量和方案会在每个回合后刷新。启动时,它会查询 Anthropic OAuth 用量端点(令牌在子进程 python3 中从 macOS 钥匙串读取,只发送到 api.anthropic.com),先填入空的窗口;响应到达后,引擎自己的数值会替换它们。非 macOS 系统或查询失败时,条会保持为 -,直到收到第一条响应。

安装

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

claude plugin marketplace add Lunik/gmz-claude-marketplace
claude plugin install usage-tracker
原文 / README

usage-tracker

Shows your Claude subscription plan and how much of the 5-hour (session) and 7-day (week) usage windows you have used.

Claude Pro ┃ session ▰▰▰▱▱▱▱▱▱▱ 32% ┃ week ▰▰▰▰▰▰▰▰▱▱ 82%

Behavior

  • Row in the bottom-right grid. Bars have 10 cells, colored green below 80%, orange from 80%, red from 90%.
  • Toast when a window first crosses 80% and again at 90%. The toast rearms after the window resets.
  • The plan label comes from claude auth status (Claude Pro, Claude Max, ...), Claude if unknown.
  • session refreshes after every model request, week and the plan after every turn.
  • Shows - and empty bars until data is available.

Startup data

Rate limits normally arrive with the first API response. To show them earlier, the plugin queries https://api.anthropic.com/api/oauth/usage at session start and on the first render:

  • The OAuth token is read from the macOS keychain (Claude Code-credentials) inside a child python3 process, so it never appears in a command line, and is sent only to api.anthropic.com.
  • Values from this call only fill empty windows. The engine's own figures replace them once a response arrives.
  • On other platforms, or if the lookup fails, the bars stay at - until the first response.

Requirements

claude on PATH (plan lookup). macOS and python3 for the startup fetch.

更多类似作品