网络搜索
让支持的模型通过 /v1/responses 或 /v1/messages 执行网络搜索。
网络搜索不是单独的端点。你通过在普通生成请求中加入托管搜索工具来启用它。
POST /v1/responses 使用 web_search,POST /v1/messages 使用 Anthropic 的
web_search_20250305 工具。
Responses API
curl https://api.tryarcflow.com/v1/responses \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "What is the latest Node.js LTS version?",
"tools": [{ "type": "web_search" }]
}'Messages API
curl https://api.tryarcflow.com/v1/messages \
-H "Authorization: Bearer sk-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "What is the latest Node.js LTS version?" }],
"tools": [{ "type": "web_search_20250305", "name": "web_search", "max_uses": 5 }]
}'说明
- 每次搜索都算作服务端工具使用,并被计量。
- Claude Messages 响应的
usage块中包含server_tool_use,你可以看到模型执行了多少次搜索。 - 使用
max_uses限制每个请求的搜索次数。