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

usage-footer

一个 Claude Code mod,在提示列下方的页脚中显示提示缓存倒计时和 5 小时及每周限制窗口的 API 等价费用,并提供可点击的按模型 token 与费用明细卡片。

omeraltinova@omeraltinova

omeraltinova/claude-usage-footer/tree/main/plugins/usage-footer

原帖图片1
已翻译

关于这个 mod

usage-footer 是一个 Claude Code 插件,把使用信息放在提示列下方的模型名称旁边。页脚显示提示缓存倒计时(颜色从绿色渐变到红色),以及当前 5 小时和每周限制窗口内请求按 API 列表价计算的费用,并按使用速度着色(若在重置前会填满限制则为红色,达到 85–100% 为黄色,否则为绿色)。点击 ▾ 或运行 /usage-footer,会在提示列上方打开一张卡片;每个窗口包含:按当前速度何时填满限制或在何处结束、总费用、缓存命中率,以及按模型列出的请求、输入、缓存读取、缓存写入、输出、命中率和费用。

它使用你账号自己的窗口(从报告的重置时间前一个窗口长度开始)。费用根据 ~/.claude/projects 中的本地记录计算,包括子代理和机器上的所有工作阶段;每个请求去重,并按 API 列表价计费(不是订阅费用)。一个小型 Node.js 脚本会在每回合结束时以及每 5 分钟增量扫描记录,只需几十毫秒,而且不会在模型请求流中运行任何东西。

要求:Claude Code v2.1.287 或更高版本(终端或 Desktop Code 标签页),以及在 macOS、Linux 和 Windows 上位于 PATH 中或标准安装位置的 Node.js。

安装: claude plugin marketplace add omeraltinova/claude-usage-footer claude plugin install usage-footer@claude-usage-footer

然后开始新的工作阶段或运行 /reload-plugins。采用 MIT 授权。

安装

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

claude plugin marketplace add omeraltinova/claude-usage-footer
claude plugin install usage-footer
原文 / README

usage-footer

A Claude Code mod that puts your usage where you look anyway: beside the model name under the prompt.

usage-footer in the terminal: the footer under the prompt and the card above it

▾ ◷42 — 5h $82 — 7d $115
  • ◷42: minutes left before this session's prompt cache expires. Green while fresh, sliding through yellow to red as it runs out.
  • 5h $82: what the requests in your current 5-hour limit window would cost at API list prices.
  • 7d $115: the same for your current weekly limit window. While the session runs Fable, this slot shows Fable's own weekly window (F $…).

The 5h and 7d values are colored by pace: red if, at the pace so far, the limit fills before the window resets; yellow if it ends the window at 85–100%; green otherwise.

Click ▾ (or run /usage-footer) for a card above the prompt with, per window:

  • when the limit fills at the current pace, or where it ends the window
  • the total cost and the cache hit rate
  • one row per model: requests, input, cache read, cache write, output, hit rate, cost

How it works

  • The windows are your account's own: each starts its length (5 hours, 7 days) before the reset time Claude Code reports for that limit, not a rolling "last 5 hours".
  • Costs come from your local transcripts (~/.claude/projects, including subagents), across every session on this machine, deduplicated per request and priced at API list prices. It is not what a subscription charges.
  • A small Node.js script scans the transcripts incrementally at the end of each turn and every 5 minutes; a scan takes tens of milliseconds. Nothing runs inside the model's request stream.

Requirements

  • Claude Code v2.1.287 or later (mods), in the terminal or the Code tab of the Desktop app.
  • Node.js on the machine. The mod looks for node on PATH, then in the usual install locations on macOS (Homebrew), Linux and Windows.
  • Works on macOS, Windows and Linux.

Install

claude plugin marketplace add omeraltinova/claude-usage-footer
claude plugin install usage-footer@claude-usage-footer

Then start a new session, or run /reload-plugins in an open one.

Notes

  • Prices are built in (plugins/usage-footer/scripts/usage-scan.mjs, PRICES) and need updating when Anthropic's prices change.
  • Usage on claude.ai (web, mobile) is not in the local transcripts, so it is not counted in the dollar figures; the limit percentages come from your account and do include it.
  • The Desktop app cuts the footer at a fixed width, so the footer stays short; the card has the details.

License

MIT

更多类似作品