Find a model

Browse the full catalog →

Attested hosted tool

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 the selected search engine from inside the attested gateway, and returns cited source material without sending the original request body through the control plane. Exa is the default.

  • web_search and web_search_preview
  • Non-streaming and Responses SSE lifecycle events
  • URL citation annotations and optional full source lists
  • At most three search calls per response
OpenAI Python SDKResponses
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)
Chat Completions

The same search engine for Chat.

/v1/chat/completions also accepts web_search and web_search_preview. These TrustedRouter compatibility aliases use the same engine selection and controls as Responses, with at most three search calls. Set max_tool_calls to a value from 1 to 3.

The OpenRouter-style openrouter:web_search tool remains supported with a parameters object and a max_uses budget of up to 30. Use one hosted search tool per request.

Chat results include citations, search_results, and URL annotations. Streaming uses Chat completion chunks; set stream_options.include_usage to receive final usage and search cost.

Function tools remain caller-executed. Hosted tools such as file_search, code_interpreter, and mcp, plus free-form custom tools, are not implemented and return explicit errors.

Chat requestJSON
{
  "model": "anthropic/claude-sonnet-5",
  "messages": [{
    "role": "user",
    "content": "What changed in Python this week? Cite sources."
  }],
  "tools": [{"type": "web_search"}],
  "tool_choice": {"type": "web_search"},
  "max_tool_calls": 1,
  "stream": true,
  "stream_options": {"include_usage": true}
}

Choose context.dev

context.dev is available through the Google Cloud, AWS, and Azure gateways:

Set "engine": "context.dev" on the web_search tool in Chat Completions or Responses. For openrouter:web_search, place it inside parameters. The name context is not accepted. Omitting the engine or selecting auto keeps Exa. An unavailable engine returns an error; it does not silently fall back to another engine or retry the search.

{"type": "web_search", "engine": "context.dev", "search_context_size": "medium"}

context.dev search costs $0.006 per provider credit, plus the selected model's token charges. This is a conservative TrustedRouter tariff, not the provider's actual dollar cost. The search requests highlights without separately billed full-page Markdown. A call requesting up to ten results reserves at most two credits ($0.012); only the provider's validated credit usage is charged and unused reservation is released.

Usage reports web_search_engine (context.dev), web_search_credits, web_search_credit_microdollars (6,000), and web_search_pricing_basis (conservative_credit_tariff). Model and search charges remain separate. context.dev supports auto mode, up to 25 results, and up to 20,000 highlight characters; Exa-only modes are rejected.

Search controls

Context

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.

Domains

Constrain sources.

Use filters.allowed_domains or filters.blocked_domains. A request may use one list, not both.

Location

Localize results.

Pass user_location with a two-letter country code. Precise city, region, and timezone controls are rejected until implemented.

Streaming

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.

Source filterJSON
{
  "type": "web_search",
  "search_context_size": "low",
  "filters": {
    "allowed_domains": ["python.org", "github.com"]
  },
  "user_location": {
    "type": "approximate",
    "country": "US"
  }
}
Privacy boundary

Search is an explicit external disclosure.

The model can derive search queries from your prompt. Exa receives those queries when selected; context.dev receives them when selected instead. The selected engine also receives configured filters and returns results to the enclave. Neither receives the original request body directly, but generated queries can contain prompt-derived information. context.dev's standard policy permits retention and use for model training; this integration does not claim ZDR.

TrustedRouter therefore rejects hosted web search on trustedrouter/zdr, trustedrouter/e2e, trustedrouter/confidential, and trustedrouter/eu routes until the selected engine has an approved compatible posture. Do not attach web_search to sensitive requests unless this disclosure is acceptable.

Review subprocessors Verify the gateway

Workspace access

Sign in

Choose a sign in method to access your TrustedRouter workspace.

New to TrustedRouter?

By continuing you agree to the terms of service and privacy policy.