Chat Completions
Addweb_search_options to a chat completion. An empty object turns search on:
- Python
- curl
[1], [2] and so on. Each cited source comes back as a url_citation annotation on the message, with the position of the citation in the text:
stream_options.include_usage to true to get the token usage as well.
Options
Your own function tools work alongside search. The model can’t search when
tool_choice is "none" or forces one of your functions. The search runs as a function named web_search, so give your own functions other names.
Responses API
Add theweb_search tool:
output as a web_search_call item, and the answer’s text carries url_citation annotations. The tool takes search_context_size and filters.allowed_domains, which limits results to the domains you list. Set max_tool_calls to cap the number of searches.
Coding tools
How you turn on search depends on the tool:Models
Search works best with models that call tools reliably. We’ve tested it with:z-ai/glm-5.3z-ai/glm-5.3-flashdeepseek/deepseek-v4.1-flashdeepseek/deepseek-v4-flash-0731qwen/qwen3.8-27bmoonshotai/kimi-k3.1-pro
Limits
- A model can search in up to 4 turns, with up to 5 searches per turn. After that it has to answer from what it found.
- Results are cut to fit the model’s context: each excerpt is at most 1,500 characters.
- If a search fails, the model is told so and answers without it.