Web Search

Allow models to access real-time information from the internet.

Overview

Some models can search the web to fetch up-to-date information when answering queries — useful for current events, recent data, or anything outside the model's training cutoff.

Usage

Enable web search by adding the web_search parameter to your request:

TypeScript
1const completion = await client.chat.completions.create({
2 model: 'gpt-4o',
3 messages: [{ role: 'user', content: 'What happened in tech news today?' }],
4 web_search: true,
5});

Web search availability varies by model and provider. Check supported parameters on the model's detail page.