B2BB2B LLM

托管网络搜索

使用 Responses API web_search 工具而不是独立端点。

托管网络搜索

Model Gate 没有单独发布 /v1/web-search 请求合同。使用 POST /v1/responses 与托管的 web_search 工具。

要求

curl https://api.model-gate.com/v1/responses \
  -H "Authorization: Bearer mg_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "input": [{"role": "user", "content": [{"type": "input_text", "text": "Find the latest official release notes."}]}],
    "tools": [{"type": "web_search"}],
    "tool_choice": "required",
    "include": ["web_search_call.action.sources"],
    "stream": false
  }'

回复

当上游模型支持托管搜索时,完成的 Responses 对象包括模型输出和可审核的 Web 搜索源。

{
  "id": "resp_...",
  "object": "response",
  "status": "completed",
  "output": [
    {
      "type": "web_search_call",
      "action": {
        "sources": [
          {"type": "url", "url": "https://example.com/source"}
        ]
      }
    },
    {
      "type": "message",
      "content": [
        {"type": "output_text", "text": "..."}
      ]
    }
  ]
}