> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Web 搜索

> 基于生产环境复核，使用 Crazyrouter 的 OpenAI 风格联网搜索能力

> 更新日期：2026-06-06

# Web 搜索

本文页只写入 `2026-03-22` 已在 Crazyrouter 生产环境复核过的 OpenAI 风格 Web Search 用法。

当前主推荐路径：

* `gpt-5.5`
* `POST /v1/responses`
* `tools: [{ "type": "web_search_preview" }]`

## 当前主结论

在今天的生产复核里：

* `gpt-5.5` 通过 Responses API 可以稳定返回 `web_search_call`
* 旧式 Chat Completions `tools: [{ "type": "web_search" }]` 探针请求虽然返回 `200`，但本轮没有拿到可验证的搜索触发信号，因此这里不把它写成主示例

***

## 已验证请求

```bash cURL theme={null}
curl https://api.crazyrouter.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.5",
    "input": "Use web search to find one current technology headline published recently.",
    "tools": [
      {
        "type": "web_search_preview"
      }
    ]
  }'
```

当前生产验证返回的关键 `output.type`：

```json theme={null}
["web_search_call", "message"]
```

这说明搜索步骤和最终回答是分开返回的。

***

## Python 示例

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.crazyrouter.com/v1"
)

response = client.responses.create(
    model="gpt-5.5",
    input="Use web search to find one current technology headline published recently.",
    tools=[
        {"type": "web_search_preview"}
    ]
)

print(response.output_text)
```

***

## 如何判断是否真的触发了搜索

推荐直接检查 `response.output`：

```python Python theme={null}
for item in response.output:
    print(item.type)
```

如果输出里出现：

```text theme={null}
web_search_call
message
```

就说明模型先做了搜索，再返回最终回答。

***

## 不建议继续把它写成主示例的旧写法

本轮生产探针还检查了 Chat Completions 的旧写法：

```json theme={null}
{
  "tools": [
    {
      "type": "web_search"
    }
  ]
}
```

结果是：

* 请求返回 `200`
* 但未拿到稳定可验证的搜索触发标志

因此当前 Crazyrouter 文档里，OpenAI 风格 Web Search 应优先按 Responses API 来写。

相关页面：

* [Responses Web 搜索](/chat/responses/web-search)
* [核心能力：Web Search](/features/web-search)
