mirror of
https://github.com/deepseek-ai/awesome-deepseek-agent.git
synced 2026-11-05 01:07:37 +00:00
[GH-ISSUE #70] deepseek-v4-pro使用 web_search 时,tool_choice.type = "tool" 会导致请求失败 #23
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/awesome-deepseek-agent#23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PageGeorge on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/deepseek-ai/awesome-deepseek-agent/issues/70
问题描述
最近在 Claude Code 中使用 DeepSeek V4 Pro 的 web search 时,偶尔会遇到工具调用失败。之前类似用法是可以正常工作的。
我还没有抓到 Claude Code 实际发出的完整请求,所以目前只能推测:失败可能和 Claude Code 在某些情况下传入了
tool_choice.type = "tool"有关。为了排查,我使用 DeepSeek Anthropic-compatible API 做了最小复现测试,发现
deepseek-v4-pro+web_search_20250305在使用tool_choice.type = "tool"时会返回 400 错误。文档描述
DeepSeek 官方文档中对
tool_choice的支持情况描述如下:noneautodisable_parallel_tool_useis ignored)anydisable_parallel_tool_useis ignored)tooldisable_parallel_tool_useis ignored)文档地址:
https://api-docs.deepseek.com/zh-cn/guides/anthropic_api
复现请求
实际返回
这里请求的模型是
deepseek-v4-pro,但错误信息中出现了deepseek-reasoner,这一点也比较令人困惑。不确定这是否和内部路由或参数校验逻辑有关。@Scarlet1ssimo commented on GitHub (May 15, 2026):
有相同问题。也是deepseek-reasoner does not support this tool_choice
@102BFW commented on GitHub (May 17, 2026):
同样的问题,请问是怎么解决的?
@PageGeorge commented on GitHub (May 17, 2026):
因为这个问题是偶尔会发生,所以我也没什么好的解决方法。最近都是正常的。如果想要解决的话,或许自己部署SearXNG这样的服务,或者是使用Tavily这样的服务,会是一个选择。
@PageGeorge commented on GitHub (May 17, 2026):
感觉是官方的问题。只能期待官方能够看到这条issue,然后修复吧。
@tianhao8687 commented on GitHub (Aug 17, 2026):
这个最小复现很有价值:当前官方 Anthropic 兼容表仍声明
tool_choice.type = "tool"受支持,因此该行为更像是“强制选择内置web_search”这一分支的服务端兼容缺陷,而不是请求格式写错。错误里出现旧的deepseek-reasoner名称,也可能说明请求进入了旧的校验路径,但仅凭报错还不能确定内部路由。现阶段可用的规避方式:
tool_choice改为auto或any;name = "web_search"把type = "tool"改为auto,不要全局删除所有tool_choice。若再次出现,建议补充响应头中的 request ID、UTC 时间、实际模型名和去除密钥后的完整 JSON;这些信息能让官方区分偶发路由问题与稳定的参数校验问题。