tools array. The AI Gateway presents it to the model, runs each tool call, and returns the model’s final answer.
Server tools are available on:
orq:image_generation is available on the Responses API only. The selected model must support tool calling.
Server tools and function tools
Server tools can share a request with function tools. Provider-hosted tools such as
web_search or file_search are separate from the orq:* tools documented here.
How server tools work
- Add one or more server tools to the request’s
toolsarray. - The model chooses whether to call a tool and supplies its runtime arguments.
- The AI Gateway executes the tool and returns the result to the model.
- The model can call another tool or finish the response.
limits.max_iterations bounds the server-side loop. It defaults to 10 model calls and accepts values from 1 to 100. max_tool_calls is accepted on both endpoints (1 to 30 on Chat Completions) and echoed in the response, but it does not limit the server-side loop.
The model sees each server tool under its type with orq: replaced by orq_ (for example orq:web_search becomes orq_web_search), and output items carry that name. Tool names must be unique within a request, so a function tool may not reuse a server tool’s name.
Quick start
This example gives the model access to web search and the current date. The model can use either tool, both tools, or neither. The upstream OpenAI TypeScript types do not defineorq:* tools, so the TypeScript examples cast the tools array.
Available tools
Web search
orq:web_search: Search the public web for current information.Web fetch
orq:web_fetch: Fetch and extract text from a public URL.Datetime
orq:datetime: Return the current date and time in an IANA timezone.Image generation
orq:image_generation: Generate an image with a configured image model.
Responses API only.Code interpreter
orq:code_interpreter: Run Python in an isolated sandbox.Shell
orq:shell: Run commands in an isolated Linux sandbox.Apply patch
orq:apply_patch: Validate file changes before the application applies
them.Knowledge bases
orq:retrieve_knowledge_bases and orq:query_knowledge_base: List and
query knowledge bases in the workspace.Search models
orq:search_models: Search the Orq.ai model catalog by capability and
cost.Subagent
orq:subagent: Delegate a self-contained task to another model.Advisor
orq:advisor: Ask another model for advice during a response.Fusion
orq:fusion: Compare answers from a panel of models.tools array also accepts orq:function, orq:http, and orq:mcp entries with a tool_id that references a tool saved in the workspace. These are references to existing platform tools, not server tools with their own configuration.
Combine server tools with functions
Function tools keep the standard OpenAI shape. The AI Gateway executesorq:* tools and returns function calls to the application.
JSON
Usage reporting
When a counted server tool runs, the response includes its call count inusage.server_tool_use.
JSON
Knowledge-base retrieval and apply-patch calls do not add a field to
usage.server_tool_use.
usage.server_tool_use_details totals the same calls across tools: tool_calls_requested counts every server tool call the model made and tool_calls_executed counts the ones the gateway ran. For web search, web fetch, shell, and fusion, a call rejected by a max_uses limit is requested but not executed. Advisor and subagent count a rejected call as executed. Chat Completions returns these counters but not the tool result itself; read the result from the Responses API output items, or send store: true and retrieve the response.
Chat Completions limitations
OnPOST /v3/router/chat/completions, a request that includes an orq:* server tool cannot also include:
ngreater than1- provider-hosted tool types such as
web_searchorfile_search orq:image_generationresponse_format.typeother thantextorjson_schematool_choiceother thanauto,none,required, or afunctionselection- a
modelthat is not inprovider/modelformat
400 for these combinations. Function tools remain supported alongside server tools.
plugins, guardrails, and evaluators are applied the same way as on requests without server tools: caller-supplied config, matched routing and guardrail rules, and workspace-enforced defaults (such as the PII redaction floor) all take effect. In streaming mode, output guardrails are skipped and output evaluators still run once the response has been assembled, matching the non-server-tool streaming behavior.
Chat Completions is stateless unless store is set to true.