所有伺服器工具
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."
}'設定、參數與範例請參閱文件。
閱讀整合指南常見問題
Mark your function tools with defer_loading: true so their schemas are withheld from the initial prompt. When the model needs a tool, it runs a regex search via openrouter:tool_search in-process and OpenRouter reveals only the matching tools for the next turn.
Tool search is supported on the Responses API (/api/v1/responses) and the Anthropic Messages API (/api/v1/messages), including OpenAI and Anthropic shorthand tool types. It runs in-process on OpenRouter with no separate tool fee.
相關工具
公用工具