Responses API Web Search
Use OpenAI-compatible web_search tools inside the attested TrustedRouter gateway with citations, source controls, streaming events, and explicit privacy limits.
Search the live web through the Responses API.
Add an OpenAI-compatible web_search tool. TrustedRouter asks the selected model for bounded search queries, calls Exa from inside the attested gateway, and returns cited source material without sending the original request body through the control plane.
web_searchandweb_search_preview- Non-streaming and Responses SSE lifecycle events
- URL citation annotations and optional full source lists
- At most three search calls per response
from openai import OpenAI
client = OpenAI(
api_key="sk-tr-v1-...",
base_url="https://api.trustedrouter.com/v1"
)
response = client.responses.create(
model="anthropic/claude-sonnet-5",
input="What changed in Python this week? Cite sources.",
tools=[{
"type": "web_search",
"search_context_size": "medium"
}],
tool_choice="required",
include=["web_search_call.action.sources"],
store=False
)
print(response.output_text)
Search controls
Bound the evidence.
Set search_context_size to low, medium, or high. Larger contexts return more source material and can increase latency and model input cost.
Constrain sources.
Use filters.allowed_domains or filters.blocked_domains. A request may use one list, not both.
Localize results.
Pass user_location with a two-letter country code. Precise city, region, and timezone controls are rejected until implemented.
Observe the search lifecycle.
Streaming responses emit response.web_search_call.in_progress, response.web_search_call.searching, and response.web_search_call.completed before normal output text events and response.completed.
{
"type": "web_search",
"search_context_size": "low",
"filters": {
"allowed_domains": ["python.org", "github.com"]
},
"user_location": {
"type": "approximate",
"country": "US"
}
}
Search is an explicit external disclosure.
The model can derive search queries from your prompt. Exa receives those queries plus configured filters and returns results to the enclave. Exa does not receive the original request body directly, but generated queries can contain prompt-derived information.
TrustedRouter therefore rejects hosted web search on trustedrouter/zdr, trustedrouter/e2e, trustedrouter/confidential, and trustedrouter/eu routes until Exa has an approved compatible posture. Do not attach web_search to sensitive requests unless this disclosure is acceptable.