Web Search

Ground responses in live web data with standardized citations

The web skill is a built-in capability managed by TheRouter. It injects web search results into the model context and normalizes URL citations in message.annotations, so downstream parsers can handle a consistent schema. Execution happens entirely inside TheRouter infrastructure.

web-search-request.json
{
  "model": "openai/gpt-4.1:online",
  "messages": [{ "role": "user", "content": "What changed in EU AI regulation this week?" }],
  "skills": [
    {
      "id": "web",
      "config": {
        "engine": "native",
        "max_results": 4,
        "search_prompt": "Use these sources and cite domain links in markdown."
      }
    }
  ]
}
Parse citations
const data = await client.chat.completions.create(request);
const annotations = data.choices[0]?.message?.annotations ?? [];

const citations = annotations
  .filter((item) => item.type === "url_citation")
  .map((item) => item.url_citation?.url)
  .filter(Boolean);

console.log(citations);
Web search adds cost
Web skill calls add search cost in addition to model tokens. Tune max_results and use search only for prompts requiring current or source-backed information.