Anthropic 更新了 Extended Thinking 文档。对开发者最重要的变化是:Claude Opus 4.8 和 Claude Opus 4.7 不再支持手动 extended thinking budget。
如果你还在这样传:
{
"thinking": {
"type": "enabled",
"budget_tokens": 32000
}
}在 Opus 4.8 / 4.7 上会返回 400 error。
新推荐:Adaptive Thinking
对于 Opus 4.8 和 Opus 4.7,应该使用:
{
"thinking": {
"type": "adaptive"
},
"output_config": {
"effort": "high"
}
}核心变化是:开发者不再手动指定预算 token,而是让模型根据当前请求判断是否需要思考、思考多少。
各模型支持情况
官方文档总结如下:
- Claude Opus 4.8:不支持手动
budget_tokens,使用 adaptive thinking - Claude Opus 4.7:不支持手动
budget_tokens,使用 adaptive thinking - Claude Mythos Preview:adaptive thinking 默认开启,也接受手动模式
- Claude Opus 4.6:推荐 adaptive thinking,手动模式仍可用但已 deprecated
- Claude Sonnet 4.6:推荐 adaptive thinking,手动模式仍可用但已 deprecated
如果你的应用会动态选择模型,就必须按模型版本处理 thinking 参数。
为什么要改?
Adaptive Thinking 更适合真实生产流量,因为请求复杂度差异很大:
- 简单查找不需要花大量 thinking tokens
- 多步骤推理需要更深思考
- Agent 循环中每一步复杂度不同
- 固定 budget 容易浪费或不够用
Opus 4.8 官方还提到:在 adaptive thinking 下,它会在需要时触发推理,简单步骤直接回答,从而减少不必要的 thinking token 消耗。
迁移建议
如果你的代码使用手动 thinking budget:
thinking = {"type": "enabled", "budget_tokens": 32000}迁移到 Opus 4.8 应改为:
thinking = {"type": "adaptive"}
output_config = {"effort": "high"}同时检查:
- 是否仍传
temperature、top_p、top_k - 是否依赖 thinking block 的固定长度
- 是否把 thinking token 成本写死进预算估算
- 是否在不同模型间复用同一请求模板
对 Agent 应用的影响
Agent 应用通常是 bimodal workload:有些 turn 很简单,有些 turn 很复杂。固定 thinking budget 往往会造成两类问题:
- 简单步骤浪费 token
- 复杂步骤预算不够
Adaptive Thinking 把这个判断交给模型,更适合长程 coding agent、研究 agent、工具调用 agent。
最佳实践
- Opus 4.8/4.7:只用 adaptive thinking + effort
- Sonnet 4.6/Opus 4.6:可以继续运行旧逻辑,但尽快迁移
- 建立按模型版本分支的 request builder
- 在日志中记录 effort 和 thinking 类型
- 重新评估成本,因为 thinking token 消耗模式会变化
来源:Anthropic 官方文档 - Building with extended thinking | 整理:ClaudeEagle