mrzzmrzz/claude-code-mods/tree/main/plugins/omni-token
omni-token
Claude Code 外掛,在提示框上方顯示即時工作階段視窗預測、tok/s、提示快取命中率與 TTL,並提供可選的快取自動預熱與 /omni-token 控制。
關於這個 mod
omni-token 是 claude-code-mods 市集中的 Claude Code 外掛,會在每個回合後更新,在提示框上方繪製工作階段視窗的即時預測。顯示內容包括天氣樣式的填滿指示器(從 Clear 到 Compact soon)、絕對值與百分比工作階段用量、12 回合 sparkline、上一回合的每秒輸出 token 數、提示快取命中率,以及提示快取到期倒數;低於 5 分鐘時倒數會變成黃色,到期後顯示 expired。使用 /plugin marketplace add mrzzmrzz/claude-code-mods 與 /plugin install omni-token@claude-code-mods 安裝。選項包括 cacheTtl(5m 或 1h)、autoWarm 與 warmHours。啟用 auto-warm 後,閒置的工作階段會在快取到期前不久傳送一個很小的分叉請求來重新啟動 TTL;它永遠不會進入記錄,並會在 warmHours 到達或快取已經冷卻時停止。/omni-token 命令會回報狀態,也能依工作階段關閉、開啟或重設預熱。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add mrzzmrzz/claude-code-mods claude plugin install omni-token
原文 / README
claude-code-mods
Mods for Claude Code, packaged as a plugin marketplace.
Install
In Claude Code:
/plugin marketplace add mrzzmrzz/claude-code-mods
/plugin install omni-token@claude-code-mods
Mods
omni-token
A live forecast of your context window, shown in the band above the prompt and updated after every turn:
Cloudy 67% 134.4k / 200k ▂▃▄▅▆█ ▲ +98.3k last turn 95 tok/s cache 96% 58:12
| Fill | Forecast (color) | | --- | --- | | < 25% | Clear (yellow) | | 25–49% | Cloudy (cyan) | | 50–74% | Showers (blue) | | 75–89% | Storm (magenta) | | ≥ 90% | Compact soon (red) |
- The sparkline covers the last 12 turns, scaled to the highest of them.
tok/sis the last turn's output tokens (thinking included) over the time from each request's start to its response's end.cache 96%is the last turn's prompt-cache hit rate: cache reads over all input tokens.58:12counts down to when the prompt cache expires: the last main-loop request's start plus the cache TTL. It turns yellow under 5 minutes and readsexpiredafter.
Options
| Option | Values | Default |
| --- | --- | --- |
| cacheTtl | 5m, 1h | 1h |
| autoWarm | true, false | false |
| warmHours | hours | 24 |
Auto-warm
With autoWarm on, while the session is idle the mod sends one tiny forked request over the main thread's own prefix shortly before the cache expires (3 minutes before on 1h, 1 minute on 5m). The cache read restarts the TTL, so the next real message reads the cache instead of rewriting the whole context. The fork never enters the transcript.
- Each warm bills a cache read of the whole context (on Claude Opus 5.5, context × $0.20/MTok) plus a few hundred output tokens.
- It stops
warmHoursafter the last turn started, and never warms an expired cache (that would pay the full write it exists to avoid) or a context under 50k tokens. warmed 3xshows how many warms ran since the last turn;warm missedmeans a warm found the cache already cold, and warming stops until the next turn.
/omni-token
| Command | Effect |
| --- | --- |
| /omni-token | Status: auto-warm on or off and why, cache TTL and time left, warms since the last turn, option names |
| /omni-token warm off | Stop auto-warming in this session, at once; other sessions and the autoWarm option are unchanged |
| /omni-token warm on | Auto-warm this session even with autoWarm off |
| /omni-token warm reset | Follow the autoWarm option again |
On a 1-hour TTL, keeping a cache warm costs 0.2/7.8 of a cold restart per hour, so it pays off for gaps under about 39 hours, if you come back.
The API's usage figures don't say which TTL a session runs on, so set it to match yours: 1h on most Claude subscriptions, 5m on the API default or in usage overage.
Developing
Load a mod straight from this checkout, with hot reload on save:
claude --plugin-dir ./plugins/omni-token
Check one before committing:
claude plugin validate ./plugins/omni-token
claude plugin test ./plugins/omni-token
