Claude Code 和 Codex 怎麼省 token?
最耗 token 的就三樣:開了很久的長工作階段、subagent、每輪都要帶上的固定內容(CLAUDE.md / AGENTS.md、MCP、skill 描述)。先做三件事:換任務就 /clear,推理強度別開太高(Codex 用預設的 medium,Claude Code 設 /effort medium),替簡單的 subagent 指定小模型。token 就是額度的計量單位,5 小時額度和每週額度扣的都是它。
Codex
換任務就 /new,日常用 medium 推理等級,雜事交給小模型,不用的 MCP 關掉。
Codex 的用量跟著上下文大小、模型、推理強度和工具呼叫走,所以省 token 就是把這四樣各砍一點。換任務時用 /new(或 /clear)開新對話,同一個任務太長了就用 /compact,/status 能看到目前的 token 用量和上下文還剩多少。模型和推理強度在 /model 裡切換:日常用 medium,難題才調高;例行任務換 GPT-5.6 Terra 或 Luna,官方寫明這樣能讓額度用得更久。Fast mode 扣得更快,額度吃緊時用 /fast 關掉。AGENTS.md 寫短、不用的 MCP 停掉,這兩樣每則訊息都要帶。
官方原文
Different models can use different amounts of your allowance for the same task. Larger inputs and outputs, higher reasoning settings, Fast mode and tasks with multiple steps can also increase usage.Higher effort can use more of your allowance and does not always produce a better result.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.Switch to a smaller model for routine tasks. Using GPT-5.6 Terra or GPT-5.6 Luna can extend your local-message usage limits, depending on the model you switch from.Reduce the size of your AGENTS.md. If you work on a larger project, you can control how much context you inject through AGENTS.md files by nesting them within your repository.Claude
先打開 /usage,看它點名的是哪一項,再對症處理:長工作階段就 /clear,subagent 就指定小模型,固定內容就瘦身。
訂閱使用者在 Claude Code 裡輸入 /usage,面板會把最近的用量歸到 skill、subagent、外掛和各個 MCP 上,並把占近期用量 10% 以上的行為單獨標出來,每條附一個建議;按 d / w 切換 24 小時和 7 天。/usage 面板上有兩句原話。一句說長工作階段即使有快取也比較貴,任務做到一半用 /compact,換任務用 /clear:「Longer sessions are more expensive even when cached. /compact mid-task, /clear when switching to new tasks.」另一句說每個 subagent 各跑各的請求,別隨手開,簡單的 subagent 可以考慮指定便宜的模型:「Each subagent runs its own requests. Be deliberate about spawning them — and consider configuring a cheaper model for simpler subagents.」對應的做法是:換任務 /clear、同一個任務做到一半才 /compact;日常用 Sonnet,effort 預設是 high、想省就 /effort medium,難題才換更大的模型或調高;簡單的 subagent 寫 model: haiku;用 /context 看固定內容占了多少,CLAUDE.md 控制在 200 行內。面板的數字依本機的工作階段紀錄估算,不含其他裝置和 claude.ai。
官方原文
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.Use /clear to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message.Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions or multi-step reasoning.常見誤解
- 裝一個省 token 的 skill 或工具,就能省一大半
不能。這類工具宣稱省 60%–90%。JetBrains 依帳單做的配對實測裡,rtk 在低推理等級每個任務反而多花 7.6%、高等級持平,caveman 宣稱省 65%、實測約 8.5%。先用 /usage 和 /context 看清楚 token 花在哪裡,再決定要不要裝。
- token 掉得快,一定是我的用法有問題
不一定。平台自己出過問題,那種情況你怎麼省都沒用。Anthropic 在 2026-04-23 的事故說明裡寫明,Claude Code 的一個快取 bug 導致了「額度掉得比預期快」的回報,並因此替所有訂閱使用者重置了額度。先到本站的重置紀錄看看最近有沒有公告,再回頭檢查自己的用法。
- 用英文寫提示比較省 token
沒有官方依據。兩家列出的影響因素是上下文大小、模型、推理強度和工具呼叫,沒有提示語言這一項。真正的大宗是長工作階段和 subagent,先砍這兩樣。
先做這幾件
- 換任務就清空:Claude Code 用 /clear,Codex 用 /new。舊對話留著,後面每則訊息都要為它再付一次。
- 推理強度別開太高:Codex 用預設的 medium;Claude Code 預設是 high,想省就輸入 /effort medium。只替難題調高,高一級更慢、更耗,不保證更好。
- 替簡單的 subagent 指定小模型:Claude Code 在 subagent 檔案開頭寫 model: haiku,Codex 在 config.toml 的 [agents] 裡設 default_subagent_model。
- 同一個任務做到一半、上下文太大時才 /compact;它本身是一次大請求,別當成日常清理。
- Claude Code 輸入 /context、Codex 輸入 /status,看上下文被什麼占了。
- CLAUDE.md 控制在 200 行內,AGENTS.md 同樣寫短;專門的流程移進 skill,用到才載入。
- 不用的 MCP 停掉,不用的外掛移除;它們每輪都占空間。
- 提示寫具體,點名檔案和函式,例如「改 auth.ts 裡的 login 函式」;「最佳化一下程式碼」會觸發大範圍讀檔。
- 都做了還是不夠,先看離下次重置還有多久,再決定要不要等。
