How It Works
Enable web search by addingweb_search_options to your chat completion request. When enabled, the model will:
- Analyze the user’s query to determine if web search is needed.
- Search the web for relevant, current information.
- Generate a response grounded in the search results, often including source citations.
Basic Example
Supported Models
Not all models support web search. Use the List LLM Models endpoint to find models wherecapabilities.web_search is true.
Parameters
With System Messages
Combine web search with system messages to control how the model uses search results:When to Use Web Search
Web search is useful when the user’s question involves:- Current events — news, stock prices, weather, sports scores
- Recent releases — software versions, product launches, research papers
- Factual lookups — statistics, regulations, schedules that change over time
- Verification — checking claims against live sources
Next Steps
Topic Extraction
Extract structured topics from text with Expert Models