A language model only knows what was in its training data. For current prices, opening hours or news, you can turn on the provider's web search. The model then searches the web itself and returns the sources along with its answer. Web search is off by default in FlowModels because each search is billed additionally.
Turn on web search
Set web_search to true in the request. This works with /chat/completions and /responses:
{
"model": "xai/grok-4.7",
"web_search": true,
"messages": [{"role": "user", "content": "Which public holidays are there in December in Hamburg?"}]
}
The model identifier here is just an example. Not every model comes with its own web search. In GET /v1/models, you can see under capabilities:
web_search: true: The model can search if you turn it on.web_search_forced: true: The model always searches, the search is built in. This applies to Perplexity models, for example.
A model without web search rejects web_search: true with 400 unsupported_for_model. Conversely, a model with built-in search rejects web_search: false, so you don't think the search is off while it's still being billed.
If you use the OpenAI library for Python, pass web_search and search_domain_filter via extra_body, see Use the OpenAI library for Python and Node.js with FlowModels.
Limit the search to specific domains
With search_domain_filter, you control where the search happens. The field automatically turns on web search too.
- Only specific sites:
"search_domain_filter": ["your-company.de", "help.your-company.de"] - Exclude specific sites:
"search_domain_filter": ["-reddit.com", "-pinterest.com"]
A few rules apply:
- Either allowed domains only or exclusions only, not a mix of both.
- Specify domains without
https://and without a path. Subdomains are included automatically. - At most 20 domains. Some models accept fewer, with xAI it's 5. The exact number is in
capabilities.web_search_domain_filter_max. - If it says
0, the model doesn't support a domain filter. Gemini is one example. The request is then rejected with400 unsupported_for_model.
A typical use is a help bot that should only look things up on your own website.
Read the sources
If the model searched, the response contains two additional fields:
citations: a list of the addresses the model usedsearch_results:title,urlanddatefor each source
"citations": ["https://www.example.de/feiertage-hamburg"],
"search_results": [{"title": "Public holidays in Hamburg", "url": "https://www.example.de/feiertage-hamburg", "date": "2026-10-02"}]
With streaming, both fields are in the last chunk before [DONE]. Without a search, they're missing entirely. It's best to show your users the sources too, so they can verify the information themselves.
What the search costs
The search is billed in addition to the tokens. You can see the total amount of a request in the response under usage.cost and in the request log. More on the cost of a request in What did my request cost?
If something goes wrong
400 unsupported_for_modelwithweb_search: The model has no search of its own, or it always searches and you sentfalse. Checkweb_searchandweb_search_forcedin the model list.400withsearch_domain_filter: Check whether you mixed allowed domains and exclusions, includedhttps://or a path, or sent too many domains.- No
citationsin the response: The model decided it doesn't need to search for this question. Make the question more specific or limit the domains.