web_search Server Tool 使模型能够在推理过程中搜索网页。模型决定何时需要搜索,ARouter 执行搜索,结果会自动注入回模型的上下文中。
这是已废弃的 web 插件和 :online 模型后缀的推荐替代方案。
快速开始
{
"model": "openai/gpt-5.4",
"messages": [{"role": "user", "content": "What happened in AI research this week?"}],
"tools": [{"type": "arouter", "arouter": {"id": "web_search"}}]
}
| 参数 | 类型 | 默认值 | 描述 |
|---|
id | string | — | 必须为 "web_search" |
max_results | integer | 5 | 返回的最大搜索结果数量 |
engine | string | 自动 | 搜索引擎:"native"、"exa"、"parallel" 或 "firecrawl" |
include_domains | string[] | — | 将结果限制在这些域名(支持通配符) |
exclude_domains | string[] | — | 排除这些域名的结果(支持通配符) |
max_total_results | integer | — | 限制一次请求中多次搜索的总结果数 |
引擎选择
| 引擎 | 描述 | 适用场景 |
|---|
| (未设置) | 如果提供商支持则使用 native,否则使用 Exa | 通用 |
"native" | 提供商内置搜索(OpenAI、Anthropic、xAI) | 最佳引用质量 |
"exa" | Exa 的神经网络+关键词混合搜索 | 研究、小众话题 |
"parallel" | Parallel 的搜索 API | 快速广泛查询 |
"firecrawl" | Firecrawl 深度爬取(BYOK) | 完整页面内容 |
解析引用
{
"choices": [{
"message": {
"role": "assistant",
"content": "According to recent research...",
"annotations": [{
"type": "url_citation",
"url_citation": {
"url": "https://arxiv.org/abs/2501.12345",
"title": "Scaling Laws for LLMs",
"content": "We study the relationship between...",
"start_index": 32, "end_index": 96
}
}]
}
}]
}
| 引擎 | 费用 |
|---|
| Exa | 每 1,000 条结果 $4.00 |
| Parallel | 每 1,000 条结果 $4.00 |
| Native(OpenAI、Anthropic、xAI) | 按提供商费率直通 |
| Firecrawl | BYOK——使用你的 Firecrawl API key |
从 Web 插件迁移
之前(已废弃):
{"model": "openai/gpt-5.4:online", "messages": [...]}
之后(推荐):
{"model": "openai/gpt-5.4", "tools": [{"type": "arouter", "arouter": {"id": "web_search"}}], "messages": [...]}