usage

usage 0.30.8

工具與目錄
在這頁

新功能 3 項

01

macOS 應用程式套件的文字介面又能開了,字寬表完整打包不閃退

從 macOS 應用程式套件啟動終端文字介面時,畫面不再因缺漏字寬資料而當場閃退。⟦出門施工若只帶工具本體,漏掉夾層裡的零件,到現場就無法開工;整箱連同配件帶齊才不缺件。⟧打包工具 py2app 原本把 rich 列在 includes,只收集靜態引用掃得到的檔案。但 rich/_unicode_data/__init__.py 是在繪圖當下以 import_module() 動態載入各版本 Unicode 字寬表,導致打包出的 app 僅帶了 __init__ 與 _versions,一畫第一張表格就當場崩潰: ``` usage --tui # 拋出 ModuleNotFoundError: No module named 'rich._unicode_data.unicode17-0-0' ``` 不經過 rich 渲染的選單列模式不受影響。現在 rich 改列在 packages,整包目錄直接複製而非只收掃得到的片段,文字介面(TUI,終端文字操作畫面)恢復正常。

官方原文

**The TUI launches from the app bundle again.** rich was listed in py2app's includes, which collects only what its static import graph can see — but rich/_unicode_data/__init__.py loads its per-version Unicode width tables through import_module() at render time, so the bundle shipped that package carrying __init__ and _versions alone and usage --tui died with ModuleNotFoundError: No module named 'rich._unicode_data.unicode17-0-0' on the first table it drew. Menu bar mode, which never renders through rich, was unaffected. rich is now a packages entry, which copies the whole tree instead of the reachable parts of it. Reported by @dvakatsiienko in #125.

02

用量表格顯示 Opus 5 與 Fable 5.1 簡稱,不再只印原始代號

打開終端機檢視用量表格時,畫面本該為各個模型顯示簡短易讀的名稱,方便一眼掌握用量分佈。但先前簡稱字典 MODEL_SHORT 裡缺少了 Opus 5 與 Fable 5.1 這兩款新條目,導致表格在列出用量時,只能直接印出長串的原始模型代號(raw model IDs),讓整行排版顯得雜亂又難以閱讀。現在用量表格已補齊這兩款模型的對照設定,會正確顯示簡短名稱。⟦手機通訊錄若漏填好友姓名,來電時螢幕只能秀出一長串電話號碼;補上暱稱後,一眼就能認出是誰撥來。⟧

官方原文

**The usage table shows a name for Opus 5 and Fable 5.1.** MODEL_SHORT had no entry for either, so both were printed as their raw model IDs.

03

配額提醒提早至用掉一半即發送,單次讀數最多一則通知

你的配額通知現在會提早跳出提醒,且單次讀數絕不連續送出兩則重複通知。Codex 0.153.0 起,五小時視窗剩不到一半就會提醒 Plus 與 Team 使用者。但 usage 先前等到 90% 才提醒,等於被監控的工具比監控端還早出聲。預設門檻在 macOS 與 Windows 一致改為 [50.0, 90.0],仍可透過 quota_notification_thresholds 自行調整。單次讀數可能一口氣跨過兩個門檻,例如 app 在配額已達 95% 時才啟動,或用量單次大跳;這時只有跨過的最高門檻會發送通知,其餘標記為已通知並鎖定,一次觀測絕不冒出兩則重複提醒。⟦河川警戒在水位達一半與九成時各廣播一次,若暴雨讓水位瞬間破九成,警報只響最緊急的紅燈,不重複播送低階警訊。⟧

官方原文

**Quota warnings now fire at 50% as well as 90%, and one reading sends at most one notification.** Codex 0.153.0 began warning Plus and Team users once a five-hour window is less than half remaining; usage waited until 90%, so the tool it monitors warned earlier than the monitor did. The default is now [50.0, 90.0] on macOS and Windows alike, still overridable through quota_notification_thresholds. Because a single reading can cross both thresholds at once — the app launching when quota is already at 95%, or a single large jump — only the highest crossed threshold sends a notification and the rest are latched, so one observation never produces two alerts saying the same thing.

修正 3 項

04

Fable 5.1 補上離線備援價格,對帳腳本不再整族跳過

Claude Code 2.1.257 起將 Fable 5.1(claude-fable-5-1)設為預設,離線計價缺口如今補齊。先前寫死的備援價目表只有 claude-fable-5,每當下載價目表缺失或過期,Fable 5.1 的每個 token(AI 計費單位)都被算成 $0。它的快取重讀價是 0.25e-6,只有 Fable 5 的四分之一,沿用舊資料也不正確。此缺口過去未被察覺,因 scripts/check_fallback_pricing.py 只比對 opus|sonnet|haiku,不論新舊皆跳過 Fable 家族。現在 Fable 5.1 已補上離線價格,對帳腳本也納入稽核。⟦保險費率表漏記新車的備援費率,斷線時計價直接歸零,查帳員還只抽查舊車;現在費率與稽核皆已補齊。⟧

官方原文

**Fable 5.1 has an offline price, and the fallback table's own audit no longer skips the entire Fable family.** Claude Code 2.1.257 made Fable 5.1 (claude-fable-5-1) the default of the Fable line, but the hard-coded fallback table only carried claude-fable-5, so whenever the downloaded price table was missing or stale every Fable 5.1 token was costed at $0. Its cache-read price is 0.25e-6 — a quarter of Fable 5's — so inheriting the older entry would not have been correct either. The gap went unreported because scripts/check_fallback_pricing.py matched only opus|sonnet|haiku: no fable model, old or new, was ever in scope for the audit that exists to catch exactly this.

05

帶日期模型不再退回新版價格,補齊五款服役中模型

查詢帶日期的舊模型離線價格時,程式不再誤退回到較新版本的便宜價格。⟦公車站牌若只看開頭數字,想搭四號公車的乘客會被載上四之六號新線;現在完整對齊路線才放行。⟧先前 _resolve_model_key 只要鍵名以查詢字串加連字號開頭就算命中。這讓 claude-opus-4-20250514 被解析成 claude-opus-4-6,離線時每百萬 token(AI 計費單位)算 $5 而非真實的 $15,只有真實費用的三分之一。現在查詢自帶版本號時,不再接受追加尾數的候選;無版本號的泛稱如 claude-sonnet 照舊解析得到,同等具體程度取較新版本,具名變體(gpt-5 到 gpt-5-pro)不受影響。表裡原本缺失但仍在服務的五個模型一併補上,並剝除 Bedrock 版本後綴讓查詢正確計價: ``` claude-opus-4 claude-opus-4-1 claude-opus-4-5 claude-sonnet-4 claude-sonnet-4-5 claude-sonnet-4-5-20250929-v1:0 # 剝除 Bedrock 後綴(v1:0)後正確計價 ```

官方原文

**A dated model no longer falls back to a newer version's pricing.** _resolve_model_key matched any table key that started with the queried name followed by a hyphen, so claude-opus-4-20250514 resolved to claude-opus-4-6 and was costed at $5/M instead of $15/M — a third of the real figure — whenever the offline table was in use. A query that already carries its own version number now rejects a candidate that merely appends another digit, while a version-less name like claude-sonnet still resolves, and among equally specific keys the newest version wins. Named variants (gpt-5 → gpt-5-pro) are unaffected. The five models still in service that the table had never carried — claude-opus-4, claude-opus-4-1, claude-opus-4-5, claude-sonnet-4, claude-sonnet-4-5 — were added, and a Bedrock version suffix is now stripped so claude-sonnet-4-5-20250929-v1:0 prices correctly.

06

備援價目表對帳改採解析比對,消除誤報與常態錯誤結束代碼

檢查備援價目表的對帳腳本現在只回報解析失敗的模型,不再給出一份無人能處理的混亂清單。先前 compare_pricing 兩個方向都用字面鍵名相減,但備援價目表本就刻意不帶日期後綴。這讓明明算得出價格的模型(例如 claude-haiku-4-5 與 claude-opus-4-7-20260416)都被報成缺漏。回報的 12 筆缺口有 3 筆是假的,腳本的結束代碼也因此長期為 1,真的缺口混在雜訊裡看不出來。現在兩個方向都改用 _resolve_model_key 判斷。⟦門禁警報若死板比對整串卡號,刻意省略換證日期的合格卡全被誤報成黑名單,警示燈常亮反而掩蓋了真正的闖入者;改採對照解析後才恢復平靜。⟧

官方原文

**The fallback pricing audit reports what actually fails to resolve, instead of a list nobody could act on.** Both directions of compare_pricing diffed raw dictionary keys, but the fallback table drops date suffixes on purpose — so models that price perfectly well, such as claude-haiku-4-5 and claude-opus-4-7-20260416, were reported as missing. Three of the twelve reported gaps were false, the script's exit code had been 1 for as long as that was true, and a real gap was indistinguishable from the noise. Both directions now resolve through _resolve_model_key.