Skip to main content
Requesty standardises web search across providers. Pass a single tool definition, { "type": "web_search" }, and Requesty translates it to the right provider format automatically. No provider-specific configuration needed.
Browse models with web search in the Requesty Console.

Supported Providers

Web search works with any model that supports tool use from these providers:
  • Anthropic - Claude models
  • OpenAI - via the Responses API (openai-responses/ prefix)
  • Google / Vertex - Gemini models

Usage

Add the web_search tool to your request:
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "messages": [
      {
        "role": "user",
        "content": "What are the news in London today?"
      }
    ],
    "tools": [{ "type": "web_search" }]
  }'
The same tool definition works for any supported provider. Just change the model:
# OpenAI Responses
"model": "openai-responses/gpt-4.1"

# Google / Vertex
"model": "vertex/google/gemini-2.5-pro"

Python Example

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_REQUESTY_API_KEY",
    base_url="https://router.requesty.ai/v1",
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-20250514",
    messages=[
        {
            "role": "user",
            "content": "What are the latest developments in artificial intelligence?"
        }
    ],
    tools=[{"type": "web_search"}]
)

print(response.choices[0].message.content)

JavaScript/TypeScript Example

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_REQUESTY_API_KEY',
  baseURL: 'https://router.requesty.ai/v1',
});

const response = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-4-20250514',
  messages: [
    {
      role: 'user',
      content: 'What are the current weather conditions in New York?'
    }
  ],
  tools: [{ type: 'web_search' }]
});

console.log(response.choices[0].message.content);

Streaming

To retrieve full search results (including all citations and source URLs), we recommend using streaming:
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_REQUESTY_API_KEY",
    base_url="https://router.requesty.ai/v1",
)

stream = client.chat.completions.create(
    model="anthropic/claude-sonnet-4-20250514",
    messages=[
        {
            "role": "user",
            "content": "What are the latest developments in artificial intelligence?"
        }
    ],
    tools=[{"type": "web_search"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Response Format

When web search is used, the response includes the AI’s answer along with citations and metadata about the search:
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Based on the search results, here are the key news stories from London today...",
        "role": "assistant",
        "annotations": [
          {
            "type": "url_citations",
            "url_citation": {
              "type": "url_citations",
              "title": "London News - Latest Updates",
              "url": "https://example.com/news",
              "start_index": 0,
              "end_index": 0
            }
          }
        ]
      }
    }
  ]
}
Web search functionality requires models that support tool use. Check the Model Library to confirm web search support for specific models.
Last modified on June 4, 2026