图解实拍 · 13 张截图

Claude Code 用量上限:把每一次任务的成本压下来

套餐额度掉得比预期快时,最有效的杠杆是「让哪个模型干活」。这篇图解跟随一个真实 Claude Code 会话:Sonnet 4.6 常驻执行,只在任务需要更强判断时才把 Opus 4.6 请进来。

The Claude Code advisor walkthrough opens on a title card promising near Opus-level intelligence at a fraction of the cost by pairing Opus as an advisor with Sonnet or Haiku as an executor
整页策略浓缩在一张卡上:便宜模型每一轮都在跑,贵模型只在真正需要时才被叫进来。

约 5 分钟 · 13 个步骤,每步都深链到原视频的精确时刻

一句话版本

真正吃掉额度的是昂贵的每一轮,而不是你打了多少条提示。这段视频里,作者给 Sonnet 执行者挂了一个顾问模型:/advisor 把 Opus 4.6 设为服务端运行的顾问,/model opusplan 是更早的「同一时间只用一个模型」的做法;视频讲解的 SWE-bench Multilingual 图上,Sonnet 4.6 High 配 Opus 顾问是 74.8%、每个 agentic 任务 $0.96,而 Sonnet 4.6 High 单干是 72.1%、$1.09。同一套拆分在 Message API 里同样可用,而 Anthropic 的 Monitor Tool 在后台盯问题,只在被触发时才消耗 token。

关于源视频

本页所有截图来自「Software Engineer Meets AI」这支三分钟的 Claude Code 顾问命令教学:在 VS Code 里对 alldevneeds 仓库实录,Claude Code v2.1.104、Sonnet 4.6、Claude Pro 套餐。

截图均标注来源,每一步都深链回源视频的精确秒数。模型价格、跑分数字与命令输出都是视频画面本身的内容——据此操作前请以 Anthropic 当前文档为准。

三个杠杆,一个会话

先弄清哪个开关管什么,再谈省钱。

  1. 1

    策略就一句话

    片头那张卡把取舍讲完了:把 Opus 当顾问、Sonnet 或 Haiku 当执行者,就能用一小部分成本拿到接近 Opus 的智力。后面整支视频,都是把这句话接进一个真实会话。

    Advisor strategy explainer card from the Claude Code video reading Pair Opus as an advisor with Sonnet or Haiku as an executor to get near Opus-level intelligence at a fraction of the cost
    接近 Opus 的智力,只在需要时才付费。跳到 0:08 观看
  2. 2

    Sonnet 4.6 以 0% 上下文开会话

    会话在 Claude Pro 套餐下以 Sonnet 4.6 启动,状态行显示 ctx 0%,因为还没发过任何内容。Sonnet 是执行者,负责一轮一轮地干活;顾问模型则是被留作储备的那一个。

    A fresh Claude Code session in the VS Code terminal on the alldevneeds repo showing Claude Code v2.1.104, Sonnet 4.6 on a Claude Pro plan, and a ctx 0% status line before a single prompt is sent
    VS Code 里的 Claude Code v2.1.104:Sonnet 4.6、Claude Pro、ctx 0%。跳到 0:16 观看
  3. 3

    影响账单的四条命令

    输入 /model 会打开命令列表,其中四条与成本有关:/model 设置 AI 模型(此刻显示 Sonnet 4.6),/effort 设置模型的 effort 等级,/advisor 配置顾问工具,/status 报告版本、模型、账号与 API 连通性。

    Claude Code slash command menu listing /model set the AI model for Claude Code currently Sonnet 4.6, /effort set effort level for model usage, /advisor consult a stronger model at key moments, and /status for version model account and API connectivity
    同一份快捷命令表里,放着模型、effort 等级和顾问。跳到 0:49 观看

把顾问挂上去

一条斜杠命令、一个选择面板、一次确认——不到一分钟。

  1. 4

    输入顾问命令

    /advisor 是入口。它的行内说明写明了整页依赖的规则:在任务的关键时刻去咨询更强的模型。强模型并不会被邀请到每一轮。

    Claude Code prompt box with /advisor typed and the inline description Configure the Advisor Tool to consult a stronger model for guidance at key moments during a task
    「配置顾问工具,让它在任务的关键时刻咨询更强的模型。」跳到 0:24 观看
  2. 5

    选哪个模型当顾问

    面板把成本讲得很直白:顾问在服务端运行,并会消耗额外的 token;把 Sonnet 作为主模型、Opus 作为顾问搭配使用,可以用更少的用量换来接近 Opus 的表现。面板给出三个选项——Opus 4.6、Sonnet 4.6、No advisor,在改动之前勾选的是 No advisor。

    Claude Code Advisor Tool panel explaining that the advisor runs server-side and uses additional tokens, listing three choices Opus 4.6, Sonnet 4.6 and No advisor with No advisor currently checked
    三个选项,以及一句提醒:顾问会多花 token。跳到 0:32 观看
  3. 6

    顾问确认为 Opus 4.6

    确认之后,命令下方留下 Advisor set to Opus 4.6 这一行。旁边的输入框仍是空的,状态行仍是 ctx 0%:还没有花掉任何东西,执行者也依然是 Sonnet 4.6。

    The Claude Code terminal confirming Advisor set to Opus 4.6 under the /advisor command with an empty prompt and a Sonnet 4.6 status line still reading ctx 0%
    「Advisor set to Opus 4.6」——第一条提示之前,拆分就已就位。跳到 0:40 观看

顾问 vs 旧的 Opus plan 做法

两种用上强模型、却不必每一轮都付钱的方式。

  1. 7

    旧做法遵循的规则

    这行叠加字说出了被顾问替代的习惯:规划交给 Opus,执行交给 Sonnet。那是同一时间只用一个模型、靠手动切换——下一帧正好把差别讲清楚。

    The Claude Code terminal at ctx 0% on Sonnet 4.6 under large white overlay text reading Planning to Opus and Executing to Sonnet, the split the creator used before the advisor command existed
    规划 → Opus,执行 → Sonnet:想事情用强模型,打字用便宜的。跳到 0:47 观看
  2. 8

    两套做法并排看

    两条结果就并排躺在同一个终端里。/advisor 报出 Advisor set to Opus 4.6;/model opusplan 报出 Set model to Opus 4.6 in plan mode, else Sonnet 4.6。按视频自己的解释:顾问方案让执行者能在任务中途调用顾问、并共享同一份上下文;而 Opus plan 同一时间只有一个模型。

    Two Claude Code command results stacked in one terminal, Advisor set to Opus 4.6 from the advisor command above Set model to Opus 4.6 in plan mode else Sonnet 4.6 from the /model opusplan command
    两条命令结果,一个问题:同样的效果,谁花的 token 更少?跳到 0:56 观看

拆分到底怎么跑

一个共享上下文、两个模型,中间一次工具调用。

  1. 9

    执行者每轮都在跑,顾问按需登场

    示意图把角色讲实了。Executor 是 Sonnet,在主循环里每一轮都运行;Advisor 是 Opus,通过一次工具调用按需抵达。顾问不产出任何面向用户的输出,只是把建议送回给执行者。

    How it works slide diagramming the advisor strategy with an Executor box labelled Sonnet runs every turn calling an Advisor box labelled Opus on demand through a tool call
    Sonnet 在主循环,Opus 藏在一次工具调用后面。跳到 1:12 观看
  2. 10

    两个模型为什么共用一个上下文

    被圈出来的那个框,就是这套功能的要点:Executor 读写由对话、工具与历史组成的 Shared context,Advisor 审阅同一份上下文并把建议写回去,于是交接时不必重新解释任务。

    The advisor strategy diagram with the Shared context box circled in red, where the Executor reads and writes conversation tools and history while the Advisor reviews that context and sends advice back
    视频圈出的共享上下文:顾问看得到执行者看到的东西。跳到 1:28 观看

视频里的那张图说明什么

分数更高、单任务成本更低——API 里也是同一套形状。

  1. 11

    分数更高,单任务成本更低

    这是视频自带的那张 SWE-bench Multilingual 图,横轴是每个 agentic 任务的成本。Sonnet 4.6 High 配 Opus 顾问是 74.8%、$0.96;Sonnet 4.6 High 单干是 72.1%、$1.09。作者把它读作「多约三个点、少约一成二的成本」,并在旁白里这么说了。

    SWE-bench Multilingual scatter chart plotting Sonnet 4.6 High plus Opus advisor at 74.8 percent for 0.96 dollars per agentic task against Sonnet 4.6 High solo at 72.1 percent for 1.09 dollars
    74.8%、$0.96 对 72.1%、$1.09——这是视频的图,不是我们的实测。跳到 2:00 观看
  2. 12

    Message API 里的同一套拆分

    这套策略并不只在 Claude Code 里。Message API 示例中执行者是 model: “claude-sonnet-4-6”,顾问则以一条工具条目出现:type 为 “advisor_20260301”、name 为 “advisor”、model 为 “claude-opus-4-6”、max_uses 为 3。下面那行注释就是盯住表计的理由:顾问 token 会在 usage 块里单独报告。

    Message API example code block with model claude-sonnet-4-6 marked executor and a tools entry typed advisor_20260301 named advisor on claude-opus-4-6 with max_uses 3, noting advisor tokens are reported separately in the usage block
    顾问 token 单独报告——usage 块让它一直可见。跳到 2:20 观看

盯住表计

后台的监看器同样要花 token。

  1. 13

    监看器也不是免费的

    视频以 Anthropic 的 Monitor Tool 幻灯片收尾。它会在后台盯着某个东西、在变化时做出反应,而且不会打断主对话;对比表则把成本说得很直:Monitor Tool 在被触发时消耗 token,而 /loop 每一次执行都要消耗 token。

    Claude Code Monitor Tool slide with a Monitor Tool versus /loop table showing the monitor consumes tokens when triggered while the loop command consumes tokens with every execution
    Monitor Tool 对 /loop:触发时花,还是每次跑都花。跳到 2:32 观看

Claude Code 成本控制常见问题