快速结论:使用 OpenAI Python SDK 调用 client.responses.create 并传入 tools=[{"type": "web_search"}] 时,未指定 user_location 会被服务端默认按美国(country: "US")估算位置,因此出现 Default web search to `type="approximate"` 相关讨论。优先排查是否显式设置了 user_location,或是否需要按需传入不带位置字段的 {"type": "approximate"}。
适用环境:OpenAI Python SDK;调用 client.responses.create 且使用 web_search 工具;Issue 未提供操作系统、Python、CUDA、显卡或依赖版本信息。
最快修复方案:暂无确认的一步修复方案。按 Issue 中的 workaround,可优先尝试传入 tools=[{"type": "web_search", "user_location": {"type": "approximate"}}],避免服务端注入默认的美国位置。SDK 默认行为未改变,官方通过文档更新说明该默认值和该写法。
注意事项:该 workaround 是 Issue 中提到的规避方式,不是 SDK 行为变更;服务端在 user_location 省略或为 null 时仍会默认美国。是否适合你的业务需自行确认,Issue 未验证其他地区或更细粒度位置字段的替代效果。
问题场景
开发者在 OpenAI Python SDK 中使用 Responses API,调用 client.responses.create,并传入 tools=[{"type": "web_search"}]。如果没有在工具配置里提供 user_location,服务端会为 web search 自动填充默认位置,并表现为 type="approximate" 且 country 为 US。这会让开发者感觉模型默认被告知用户位于美国,与预期不符。
报错原文
Default web search to `type="approximate"`
原因分析
根据 Issue 讨论,这不是 Python SDK 本地抛出的异常,而是 Responses API 服务端对 web_search 工具的默认补全行为:当 user_location 省略或为 null 时,服务端会按估算位置处理,默认国家为 US,并生成类似 "type": "approximate"、"country": "US" 的结构。Issue 正文称该行为“by design”,评论摘要也确认文档更新后仍保留这一默认行为,SDK 默认行为未改变。
环境排查
- 确认当前使用的是 OpenAI Python SDK,并且调用的是
client.responses.create。 - 确认请求中
tools是否包含web_search,以及是否传入或省略了user_location。 - 确认
user_location是否为null;Issue 指出省略或为 null 都会触发文档所述的美国默认。 - Issue 未提供 Python、SDK、操作系统、CUDA、显卡等版本信息,无需补充无证据项。
解决步骤
- 检查请求体中 web search 工具的写法,确认是否使用了
tools=[{"type": "web_search"}]。 - 如果希望避免服务端默认注入美国位置,按 Issue 中给出的 workaround,将工具配置改为
tools=[{"type": "web_search", "user_location": {"type": "approximate"}}]。 - 如果你确实需要指定位置,则不要只写
type,应按 API 支持的字段提供城市、国家、地区或时区等位置信息;Issue 未展开这些字段的细节。 - 如果依赖 SDK 默认行为,则注意服务端仍可能默认美国;官方通过文档更新说明了该默认值和上述 workaround。
- 如果问题表现为报错而非默认位置不符合预期,请单独确认错误来源,因为本 Issue 讨论的是默认行为与文档缺失,而不是异常堆栈。
验证方法
重新发起一次 client.responses.create 请求,检查传入的 tools 是否已包含 user_location。如果按 workaround 添加 {"type": "approximate"} 后不再出现美国默认位置注入,说明已绕过该默认行为。若仍看到 country: "US" 或系统提示注入美国位置,则说明当前调用路径仍命中了服务端默认逻辑,需继续检查请求参数。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。

![[BUG]: Weekly and monthly scheduled jobs run a day early or late when the local time is on a different UTC date](https://www.chat-gpts.plus/wp-content/uploads/2026/10/6555-578b341a-768x403.jpg)
![[Bug] Codex heterogeneous agent loses session continuity every turn (sessionId missing from stream_start, regression of #16855)](https://www.chat-gpts.plus/wp-content/uploads/2026/10/20231-3455eac7-768x403.jpg)