Server Tools

Beta
Tools operated by OpenRouter that models can call during request
Beta

Server tools are currently in beta. The API and behavior may change.

Server tools are specialized tools operated by OpenRouter that any model can call during a request. When a model decides to use a server tool, OpenRouter executes it server-side and returns the result to the model — no client-side implementation needed.

Server Tools vs Plugins vs User-Defined Tools

Server ToolsPluginsUser-Defined Tools
Who decides to use itThe modelAlways runsThe model
Who executes itOpenRouterOpenRouterYour application
Call frequency0 to N times per requestOnce per request0 to N times per request
Specified viatools arrayplugins arraytools array
Type prefixopenrouter:*N/Afunction

Server tools are tools the model can invoke zero or more times during a request. OpenRouter handles execution transparently.

Plugins inject or mutate a request or response to add functionality (e.g. response healing, PDF parsing). They always run once when enabled.

User-defined tools are standard function-calling tools where the model suggests a call and your application executes it.

Available Server Tools

ToolTypeDescription
Web Searchopenrouter:web_searchSearch the web for current information
Datetimeopenrouter:datetimeGet the current date and time

How Server Tools Work

  1. You include one or more server tools in the tools array of your API request.
  2. The model decides whether and when to call each server tool based on the user’s prompt.
  3. OpenRouter intercepts the tool call, executes it server-side, and returns the result to the model.
  4. The model uses the result to formulate its response. It may call the tool again if needed.

Server tools work alongside your own user-defined tools — you can include both in the same request.

Quick Start

Add server tools to the tools array using the openrouter: type prefix:

1const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
2 method: 'POST',
3 headers: {
4 Authorization: 'Bearer {{API_KEY_REF}}',
5 'Content-Type': 'application/json',
6 },
7 body: JSON.stringify({
8 model: '{{MODEL}}',
9 messages: [
10 {
11 role: 'user',
12 content: 'What are the latest developments in AI?'
13 }
14 ],
15 tools: [
16 { type: 'openrouter:web_search' },
17 { type: 'openrouter:datetime' }
18 ]
19 }),
20});
21
22const data = await response.json();
23console.log(data.choices[0].message.content);

Combining with User-Defined Tools

Server tools and user-defined tools can be used in the same request:

1{
2 "model": "openai/gpt-5.2",
3 "messages": [...],
4 "tools": [
5 { "type": "openrouter:web_search", "parameters": { "max_results": 3 } },
6 { "type": "openrouter:datetime" },
7 {
8 "type": "function",
9 "function": {
10 "name": "get_stock_price",
11 "description": "Get the current stock price for a ticker symbol",
12 "parameters": {
13 "type": "object",
14 "properties": {
15 "ticker": { "type": "string" }
16 },
17 "required": ["ticker"]
18 }
19 }
20 }
21 ]
22}

The model can call any combination of server tools and user-defined tools. OpenRouter executes the server tools automatically, while your application handles the user-defined tool calls as usual.

Usage Tracking

Server tool usage is tracked in the response usage object:

1{
2 "usage": {
3 "input_tokens": 105,
4 "output_tokens": 250,
5 "server_tool_use": {
6 "web_search_requests": 2
7 }
8 }
9}

Next Steps

  • Web Search — Search the web for real-time information
  • Datetime — Get the current date and time
  • Tool Calling — Learn about user-defined tool calling