gmorubio/claude-mods/tree/main/turn-usage
關於這個 mod
每則 Claude 回覆下方都有一行淡色文字,顯示目前工作階段用量限制的使用比例,以及剛結束的一輪消耗的比例:
Session: 39% used · this turn: <1%
「current session」數值指 5 小時用量視窗,也就是 Claude 用量設定中稱為「Current session」的同一個視窗。
隨用隨付(API key、Bedrock 或 Vertex)沒有用量視窗,因此這一行會依 /cost 的統計方式,以美元顯示工作階段與這一輪的費用:
Session: $1.84 · this turn: $0.12
如何讀取
訂閱方案中:
| 顯示內容 | 意義 |
| --- | --- |
| this turn: +2% | 這一輪期間工作階段數值上升了 2 個百分點 |
| this turn: <1% | 這一輪沒有讓工作階段數值完整上升 1 個百分點 |
| this turn: — | 沒有可比較的數值:工作階段的第一輪在任何讀數到達前就結束了 |
訂閱視窗(5 小時或每週視窗)用完後,仍然完成的一輪使用了額外用量,因此這一行會顯示該輪費用,而不是百分點:
Session: 100% used · this turn: $0.12 (extra usage)
跨過 100% 的那一輪仍以百分點計量;從下一輪開始顯示費用。
隨用隨付與額外用量中,不到 1 美分的一輪會顯示 <$0.01。費用是 Claude Code 根據權杖和公開 API 價格估算的數值,不論帳單使用哪種貨幣都一律以美元顯示,不是發票金額。
工作階段的第一輪之前沒有讀數,因為這個數值只有在 API 回應中才會到達。如果 5 小時視窗正好由這一輪開始,這一輪會從 0% 開始;否則使用這一輪第一次請求附帶的讀數,因此只會漏掉那一個請求。
用量數值來自 API 的速率限制標頭,它們回報完整百分點,所以一輪的比例也只能精確到這個程度:+1% 可能只是較小的一輪剛好跨過一個百分點。這個數值屬於你的帳號,因此同時執行的其他 Claude 工作階段也會計入。
語言
這一行使用英文;當 Claude Code 的 language 設定為西班牙文(~/.claude/settings.json 中為 "language": "spanish")時,則使用西班牙文:
Sesión: 39% usado · este turno: <1%
需求
- 桌面應用程式或終端機中的 Claude Code,使用 Claude 訂閱或隨用隨付。
- 支援 function-hook mods 的 Claude Code 建置版本(
hooks/hooks.json中含有modules)。
安裝
在 shell 中:
claude plugin marketplace add gmorubio/claude-mods
claude plugin install turn-usage@claude-mods
或者在 Claude Code 工作階段中一次執行:
/plugin install turn-usage --marketplace gmorubio/claude-mods
或者在單一工作階段中從本機 checkout 載入:
claude --plugin-dir /path/to/claude-mods/turn-usage
建置方式
hooks/register.tsx 就是整個 mod。它在一輪開始與完成時讀取 5 小時視窗(沒有視窗時讀取工作階段費用),把回覆最後的文字和用量列一起保存;當桌面應用程式或終端機繪製回覆文字區塊時,在結束該回覆的區塊下方加入這一列。
隱私
turn-usage 不會發出網路請求,也不會把任何內容傳到別處。請參閱隱私權政策。
授權條款
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add gmorubio/claude-mods claude plugin install turn-usage
原文 / README
turn-usage
A dim line under each Claude reply that shows how much of your current session's usage limit is used, and how much the turn that just ended spent:
Session: 39% used · this turn: <1%
The "current session" figure is the five-hour usage window, the same one Claude's usage settings call "Current session".
On pay as you go (an API key, Bedrock or Vertex) there is no usage window, so the line shows what the session and the turn cost instead, in US dollars, as /cost counts it:
Session: $1.84 · this turn: $0.12
How it reads
On a subscription:
| Shown | Meaning |
| --- | --- |
| this turn: +2% | The session figure rose 2 points during the turn |
| this turn: <1% | The turn didn't move the session figure a whole point |
| this turn: — | Nothing to compare against: the session's first turn ended before any reading came |
Once a subscription window (the five-hour or the weekly one) is used up, a turn that still completes ran on extra usage, so the line shows that turn's cost instead of its points:
Session: 100% used · this turn: $0.12 (extra usage)
The turn that crosses 100% is still measured in points; the cost shows from the next one.
On pay as you go and extra usage, a turn under a cent shows <$0.01. The cost is Claude Code's estimate from the tokens and the public API prices, always in dollars whatever your billing currency, not your invoice.
A session's first turn has no reading from before it, since the figure only arrives with an API response. If the five-hour window began with that turn, the turn started it at 0%; otherwise the reading that came with the turn's first request stands in, which leaves out only that one request.
The usage figure comes from the API's rate-limit headers, which report whole percentage points, so a turn's share is only as precise as that: a +1% can be a smaller turn that happened to cross a point. The figure is your account's, so other Claude sessions running at the same time count towards it too.
Language
The line is in English, or in Spanish when Claude Code's language setting is Spanish ("language": "spanish" in ~/.claude/settings.json):
Sesión: 39% usado · este turno: <1%
Requirements
- Claude Code in the desktop app or the terminal, on a Claude subscription or pay as you go.
- A Claude Code build with function-hook mods (
hooks/hooks.jsonwithmodules).
Install
In your shell:
claude plugin marketplace add gmorubio/claude-mods
claude plugin install turn-usage@claude-mods
Or both at once from inside a Claude Code session:
/plugin install turn-usage --marketplace gmorubio/claude-mods
Or load it from a local checkout for one session:
claude --plugin-dir /path/to/claude-mods/turn-usage
How it's built
hooks/register.tsx is the whole mod. It reads the five-hour window (or, with none, the session's cost) when a turn starts and again when it completes, keeps the reply's final text with its usage line, and when the desktop or the terminal draws a reply's text block, adds the line under the block that ends that reply.
Privacy
turn-usage makes no network requests and sends nothing anywhere. See the privacy policy.
