Token 知識庫

額度什麼時候重置、怎麼省 token?依目錄查閱各個主題,Codex 和 Claude 分開說明,附官方原文和連結。

省 token 的 skill 和工具(rtk、caveman)真的有用嗎?

有一點用,但遠沒有宣稱的多。JetBrains 在 Claude Code 上依帳單做的配對實測:caveman 宣稱省 65%,實測輸出 token 少 8.5%;rtk 宣稱省 60–90%,實測低推理等級帳單反而多 7.6%,高等級持平。兩個工具都沒有讓任務品質變差。裝之前先用 /usage 看清楚 token 花在哪裡,裝之後看帳單,不看工具自己報的數字。

Codex

沒有在 Codex 上做的公開配對實測;判斷方法一樣:比自己帳號的 token 用量,不看工具自己報的數字。

rtk 和 caveman 都支援 Codex,但上面兩次實測只在 Claude Code 上做過,數字不能直接套到 Codex。道理是通用的:OpenAI 寫明提示、檔案、聊天紀錄、工具結果和回覆全都算 token,指令輸出只是其中一塊,只壓這一塊,整體省不了多少。自己驗證時,用 Codex CLI 的 /usage daily 和 /usage weekly 看帳號的 token 用量,/status 看剩餘額度。OpenAI 官方給的省法是另外幾條:提示寫精準、只給相關檔案、AGENTS.md 寫短、不用的 MCP 關掉、日常換小一級的模型。

官方原文

Tokens are small units of information that ChatGPT reads and writes. Your prompt, files, chat history, tool results, and ChatGPT's response all use tokens.
OpenAI Developers · Codex pricing
Limit the number of MCP servers you use. Every MCP server adds more context to your messages and uses more of your limit. Disable MCP servers when you don't need them.
OpenAI Developers · Codex pricing
/usage — View account token usage or use a rate-limit reset. Inspect daily, weekly, or cumulative ChatGPT token activity from inside the TUI.
OpenAI docs · Developer commands

Claude

實測省得很少:caveman 輸出 token 少 8.5%,rtk 帳單多 7.6% 或持平;任務品質都沒有變差。

兩次實測都是 JetBrains 做的:Claude Code、claude-sonnet-5、SkillsBench 的 86 個程式任務,同一個任務裝和不裝各跑一遍再成對比較。caveman 測的是強制每則回覆都啟用的最佳情況,輸出 token 少 8.5%(592k 到 542k,82 對任務),成本約少 10%。rtk 依預設安裝,低推理等級每個任務的成本中位數多 7.6%(80 對,p=0.004),高推理等級 +0.1%(p=0.99)。文中的宣稱數字是 2026 年 7 月實測時兩個專案 README 的寫法。

官方原文

rtk advertised saving: 60–90%. Measured on real agent work: +7.6% more expensive at low reasoning effort (p=0.004), ±0% at high effort. Setup: Claude Code 2.1.201 · claude-sonnet-5 low and high efforts · SkillsBench. Task quality: unchanged in both arms, at both effort levels.
JetBrains Blog · Does "rtk" skill really cut agent tokens by 60–90%? We tested it
Advertised saving: 65%. Measured saving: 8.5%. Output-token saving on real agentic tasks, with the skill forcibly activated. This is the ceiling, not the usual-case result.
JetBrains Blog · Does Speaking to Agents Like Cavemen Really Save 65% of Tokens? We Test
a tool's self-reported savings are a claim about its counterfactual, not about your bill. rtk's scoreboard said 96 million tokens saved while the invoice went up. If you evaluate any context-compression tool, measure the paired bill, not the tool's diff.
JetBrains Blog · Does "rtk" skill really cut agent tokens by 60–90%? We tested it
On a Pro, Max, Team, or Enterprise plan, /usage also shows a breakdown of what counts against your plan limits: Attribution: recent usage attributed to skills, subagents, plugins, and individual MCP servers, each shown as a percentage of the total.
Claude Code docs · Manage costs effectively

為什麼省得這麼少

能壓的那部分本來就小。寫程式時 agent 的輸出大多是程式碼、diff 和工具呼叫,caveman 不碰這些,變短的只有工具呼叫之間那幾句說明。

Claude Code 讀檔、搜尋用的是內建的 Read 和 Grep,不經過 rtk 用的 Bash hook;模型讀進去的內容裡,rtk 碰得到的工具輸出只有約五分之一。JetBrains 估算的理論上限是帳單的 3% 左右。

只想過濾囉嗦的指令輸出的話,Claude Code 官方文件自己就給了一個只回傳失敗那幾行的 hook 範例。

官方原文

Advertised savings come from chat-style prose answers. Agentic output is different: code, diffs, tool invocations, and exact error strings dominate the token stream, and Caveman correctly leaves all of it verbatim.
JetBrains Blog · Does Speaking to Agents Like Cavemen Really Save 65% of Tokens? We Test
Custom hooks can preprocess data before Claude sees it. Instead of Claude reading a 10,000-line log file to find errors, a hook can grep for ERROR and return only matching lines, reducing context from tens of thousands of tokens to hundreds.
Claude Code docs · Manage costs effectively

兩個專案現在怎麼說

實測之後,兩個專案的 README 都更新了說法。rtk 現在寫的是「最多砍掉 agent 讀到的 bash 輸出的 90%」,並寫明這不等於帳單少 90%。caveman 直接引用了 8.5% 這個結果,並在那之後新增了壓縮工具輸出的代理;JetBrains 沒測過這部分。

兩個工具的壓縮本身是真的,兩次實測裡任務品質也都沒有變差。差別在使用情境和帳怎麼算。

官方原文

RTK cuts up to 90% of the bash output your agent reads. That is what RTK measures, and it is not the same as cutting your bill by 90%.
rtk-ai/rtk on GitHub · README
The JetBrains number is why the proxy exists. They measured the skill alone, in July 2026, before the proxy shipped.
JuliusBrussee/caveman on GitHub · README

常見誤解

  • 工具自己統計省了幾千萬 token,帳單一定也省了這麼多

    不是。JetBrains 的低推理等級整輪測試裡,rtk 內建的統計報出省了 9,620 萬 token,同一批任務的帳單卻是漲的。JetBrains 給了三個原因:它拿完整的原始輸出當對照基準,而 Claude Code 本來就會截斷超長輸出;它在指令執行時依「字元數 ÷ 4」估 token,而一次工作階段的輸入大宗是依快取價計算的重讀;hook 根本看不到大部分的上下文。

  • 裝一個省 token 的 skill,就能省掉一大半

    不會。宣稱的 65% 來自聊天式問答;寫程式時 agent 的輸出大多是程式碼、diff 和工具呼叫,這些 skill 不會去壓,能壓的只有中間那幾句說明。實測上限是輸出 token 少 8.5%,而且是強制每則都啟用的情況,平常只會更少。

  • 實測說省不了多少,那這些工具就是騙人的

    不是。兩次實測裡任務品質都沒有變差,壓縮本身是真的,JetBrains 對 rtk 的評語是「Honest engineering, wrong counterfactual」(工程做得實在,只是對照基準選錯了)。兩個專案現在的 README 也都改了說法:rtk 寫明砍掉 bash 輸出不等於帳單少這麼多,caveman 直接引用了 8.5% 這個數字。差別在使用情境和帳怎麼算,不在工具的真假。

建議

  • 裝之前先看 token 花在哪裡:Claude Code 執行 /usage(按 d 或 w 切換 24 小時和 7 天)和 /context;大宗是長工作階段或 subagent 的話,壓縮指令輸出的工具幫不上忙。
  • 自己驗證就比帳單:裝之前和裝之後各用幾天,任務類型相近,對比 /usage(Codex 用 /usage weekly)裡的用量;不要拿工具自己統計的「已省多少 token」當結論。
  • 別只試一次就下結論:rtk 那次實測裡,同一個任務原樣重跑,成本中位數就能差 22%;caveman 第一輪 10 個任務的小樣本顯示省 29.5%,擴大到 86 個任務後是 8.5%。
  • 裝之後留意有沒有多跑幾輪:rtk 實測裡對話輪數多了 13.8%、快取讀取多了 14.3%,多出來的錢就花在這裡。
  • 只想過濾測試和日誌輸出:Claude Code 官方 costs 頁有現成的 PreToolUse hook 範例,只回傳失敗的那幾行,不用裝第三方工具。
  • 任何 skill 本身也有每輪開銷:它的描述每輪都帶著。

Codex 重置公告與紀錄 · Claude 重置公告與紀錄