- Search-preview 模型 — 直接在
/v1/chat/completions上調用一個搜索變體模型 - 常規模型 + 工具/選項 — 傳
web_search_options(Chat)或tools: [{"type": "web_search"}](Responses)
Search-preview 模型(OpenAI)
OpenAI 為多個模型發布了 search-preview 變體——例如openai/gpt-4o-search-preview 和 openai/gpt-5-search-api。
把其中之一設為 /v1/chat/completions 的 model,上游會在服務端
完成搜索。
調用 /v1/models 獲取實時目錄。
web_search_options(Chat Completions)
search_context_size:low / medium / high。控制搜索深度
(web_search 的每次調用價格與深度無關)。
Tools(Responses API)
/v1/responses 接受 tools: [{"type": "web_search"}],對 OpenAI 模型
和任意 Grok 模型都有效——xAI 的 Agent Tools 接口住在同一個端點上。
web_search_call 都會按內置工具計費——參閱
運維 / 計費與用量。
跨服務商支持
聯網搜索能觸達每一家提供該能力的服務商;只是入口不同:| 服務商 | 聯網搜索 | 入口 |
|---|---|---|
| OpenAI | ? | Search-preview 模型,或在 /v1/responses 傳 web_search 工具 |
| xAI Grok | ? | 在 /v1/responses 配合任意 Grok 模型傳 tools: [{"type": "web_search"}] —— 即 xAI 的 Agent Tools API。(xAI 已于 2026-01-12 棄用 chat completions 上的舊 search_parameters;舊的 *-search 模型名變體不再可用。) |
| Anthropic | ? | 在 Chat Completions 請求上傳 web_search_options —— 會被翻譯為 Anthropic 原生的 web_search 服務端工具。search_context_size(low/medium/high)映射到 max_uses;user_location.approximate 映射到 Anthropic 的 user_location。 |
| Gemini | ? | 傳一個名為 googleSearch 的函數工具(見下文)—— 會被翻譯為 Gemini 原生的 GoogleSearch 接地工具。 |
| DeepSeek | ? | DeepSeek API 不提供聯網搜索。 |
Gemini 通過 googleSearch 接地
對于 Gemini 模型,OrcaRouter 的翻譯層會識別魔法函數名
googleSearch,并把它轉換為 Gemini 原生的 GoogleSearch 接地工具。
像傳任何其他 OpenAI 風格函數工具那樣傳它即可:
webSearchQueries 等)會被網關捕獲用于計費,
并通過標準 chat-completion 字段透出。另外兩個魔法函數名走同一條
代碼路徑:
codeExecution—— 啟用 Gemini 原生代碼執行工具urlContext—— 啟用 Gemini URL 上下文工具
或者直接走原生
如果你已經在用 Gemini 的/v1beta/ 原生協議,按 Gemini 形態直接傳
googleSearch 即可,無需走魔法名翻譯:
{"codeExecution": {}} 和 {"urlContext": {}} 在原生路徑上工作方式
相同。參閱原生格式 / Gemini。
計費
web_search 與 web_search_preview 按內置工具調用計費,單價梯度
不同——參閱運維 / 計費與用量
查看明細。