Skip to main content

Documentation Index

Fetch the complete documentation index at: https://concentrate.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Web search is a built-in tool that allows models to search the web during a response. Unlike function tools, you don’t need to define a schema or handle execution yourself — the model searches the web automatically and incorporates the results into its answer. Add {"type": "web_search"} to your tools array to enable it.

Prerequisites

Before using web search, ensure you have:

Quick Start

curl https://api.concentrate.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.2",
    "input": "What happened in the news today?",
    "tools": [
      {
        "type": "web_search"
      }
    ]
  }'

Tool Parameters

ParameterTypeRequiredDescription
typestringYesMust be "web_search"
search_context_sizestringNoAmount of search context: "low", "medium", or "high". Defaults to provider behavior
filtersobjectNoFilter search results by domain
user_locationobjectNoApproximate user location for localized results
search_context_size, filters, and user_location are not supported by Google Vertex AI (Gemini) or Mistral models. These parameters are silently ignored for those providers.

Search Context Size

Controls how much search context the model uses. Higher values may return more detailed results but use more tokens.
{
  "type": "web_search",
  "search_context_size": "medium"
}

Domain Filtering

Restrict search results to specific domains:
{
  "type": "web_search",
  "filters": {
    "allowed_domains": ["wikipedia.org", "bbc.com"]
  }
}

User Location

Provide an approximate location for more relevant local results:
{
  "type": "web_search",
  "user_location": {
    "type": "approximate",
    "country": "US",
    "region": "California",
    "city": "San Francisco",
    "timezone": "America/Los_Angeles"
  }
}
All user_location fields are optional.

Response Format

When the model performs a web search, the response output array includes a web_search_call item:
{
  "output": [
    {
      "type": "web_search_call",
      "id": "ws_abc123",
      "status": "completed",
      "action": {
        "type": "search",
        "query": "latest news today",
        "sources": [
          {
            "type": "url",
            "url": "https://example.com/article"
          }
        ]
      }
    },
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Here's what's happening today..."
        }
      ]
    }
  ]
}
The sources array contains the URLs the model referenced. Use these to provide citations in your application.

Combining with Function Tools

Web search works alongside function tools in the same request:
{
  "model": "gpt-5.2",
  "input": "Search for the latest Tesla stock price and convert it to EUR",
  "tools": [
    {
      "type": "web_search"
    },
    {
      "type": "function",
      "name": "convert_currency",
      "description": "Convert between currencies",
      "parameters": {
        "type": "object",
        "properties": {
          "amount": { "type": "number" },
          "from": { "type": "string" },
          "to": { "type": "string" }
        },
        "required": ["amount", "from", "to"]
      }
    }
  ]
}

Provider Limitations

Google Vertex AI (Gemini) and Mistral models do not support using web search and function tools together in the same request. When both are provided, function tool calling takes priority and web search is ignored. To use web search with these providers, use tool_choice to explicitly select it:
{
  "model": "gemini-2.5-pro",
  "input": "What happened in the news today?",
  "tools": [
    { "type": "web_search" },
    {
      "type": "function",
      "name": "convert_currency",
      "description": "Convert between currencies",
      "parameters": {
        "type": "object",
        "properties": {
          "amount": { "type": "number" },
          "from": { "type": "string" },
          "to": { "type": "string" }
        },
        "required": ["amount", "from", "to"]
      }
    }
  ],
  "tool_choice": {
    "type": "allowed_tools",
    "mode": "auto",
    "tools": [{ "type": "web_search" }]
  }
}

Provider Support

Web search is supported across multiple providers:
ProviderSupportedNotes
OpenAIYesGPT-4o, GPT-4.1, GPT-5 family
AnthropicYesClaude Sonnet, Opus, Haiku models
xAIYesGrok-4 family
Google Vertex AIYesGemini models. No search_context_size/filters support. Cannot combine with function tools
MistralYesMistral Small, Medium, Magistral. No search_context_size/filters support. Cannot combine with function tools
Check specific model support using the List Models endpoint.

Tool Calling

Define custom function tools

Create Response

Main API endpoint reference