Web 搜索工具

Web 搜索是 Responses API 的内置工具,模型在需要实时信息时自动联网检索。

使用 Web 搜索工具

tools 里声明 web_search

json
{
  "model": "gpt-5.6-sol",
  "input": "今天北京的天气如何?请联网查",
  "tools": [{"type": "web_search"}]
}

响应结构

output 数组里会依次出现 reasoningweb_search_call(模型执行的搜索)以及最终的 message;搜索过程无需客户端处理,直接读取 messageoutput_text 即可。

准备好了?三步即可开始登录控制台 · 购买额度 · 创建 API Key
DiscordGet community help instantly
Web 搜索工具 · 帮助文档