所有服务器工具
Tool search
openrouter:tool_search
避免将大型工具库放入提示词。将您自己的工具标记为 defer_loading,模型就会搜索所需的工具,从而不再让数百个工具定义在每轮消耗输入 token,同时保持工具选择的准确性。
工作原理
适用于大型工具库:大致超过 10 个工具或工具定义超过 10k token 的情况。低于此规模时,标准工具调用更简单。
- 1
您的应用 将函数工具标记为 defer_loading,使其不包含在提示词中。
- 2
您的模型 在需要工具时,使用模式搜索延迟加载的工具。
- 3
OpenRouter 根据名称、描述和参数显示最佳匹配项。
- 4
您的应用 像处理其他函数调用一样处理对已公开工具的调用。
提供商与定价
OpenRouter
免费
在请求期间于 OpenRouter 的进程内运行。
每个请求均按标准模型 token 费用计费。
使用此工具
将您自己的函数工具标记为 defer_loading。OpenRouter 在服务端运行搜索并向模型提供匹配的工具,您的应用则像处理其他函数调用一样处理这些已提供工具的函数调用。
可通过 API 使用。 仅影响将其他工具标记为 defer_loading 的请求,而 Chatroom 不会这样做。
支持的 API:Responses and Anthropic Messages。
shell
curl https://openrouter.ai/api/v1/responses \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.2",
"tools": [
{
"type": "openrouter:tool_search"
},
{
"type": "function",
"name": "book_restaurant",
"description": "Reserve a restaurant table for a party at a given date and time.",
"parameters": {
"type": "object",
"properties": {
"party_size": {
"type": "integer",
"description": "Number of guests."
},
"datetime": {
"type": "string",
"description": "Reservation time as an ISO 8601 timestamp."
}
},
"required": [
"party_size",
"datetime"
]
},
"defer_loading": true
},
{
"type": "function",
"name": "create_calendar_event",
"description": "Add an event to the user’s calendar.",
"parameters": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Event title."
},
"start": {
"type": "string",
"description": "Start time as an ISO 8601 timestamp."
}
},
"required": [
"title",
"start"
]
},
"defer_loading": true
}
],
"input": "Book me a table for four tomorrow night and add it to my calendar."
}'文档中提供了设置、参数和示例。
阅读集成指南相关工具
实用工具