Web Search
Level: Beginner · Category: API reference
Tags: Search · Grounding · Retrieval
The LLM API can search the public web in two ways: a search endpoint that returns results for your
own code, and a web_search tool that some chat models use on their own. Both go through a
SearXNG metasearch server run by Research Computing, so your search queries are sent to public
search engines (your chat prompts are not). Keys and setup are on LLM API Access.
Search endpoint
POST https://openai.rc.asu.edu/v1/search returns titles, URLs and snippets:
curl -s https://openai.rc.asu.edu/v1/search \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "Gaudi 2 HPU memory", "max_results": 3}'
{
"id": "…",
"object": "search",
"results": [
{"title": "Habana Gaudi2 AI Processor for Deep Learning …", "url": "https://www.intel.com/…", "snippet": "…", "date": null, "last_updated": null}
]
}
| Field | Meaning |
|---|---|
query | Required. A string (or a list of strings, joined), up to 2,000 characters. |
max_results | 1 to 20 |
search_domain_filter | Up to 20 domains to keep, for example ["arxiv.org", "nature.com"]. Prefix a domain with - to exclude it. |
time_range | day, month or year |
language, categories, engines, safesearch, pageno | Passed to SearXNG |
GET /v1/search/tools lists the search backends your key can use. There is one today,
searxng-search, so you don't need to name it. Searches are free and take a slot in the search
server's own queue, separate from the models.
Let a chat model search
Some chat models have the web_search add-on (boon_details.web_search.active in
/v1/models; glm-5-3 is one). The gateway gives the model a web_search tool and runs the
searches it asks for, so the model can answer questions about recent events and cite sources. You
call the model as usual:
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY and OPENAI_BASE_URL
completion = client.chat.completions.create(
model="glm-5-3",
reasoning_effort="low",
messages=[{"role": "user", "content": "Search the web: what is the latest released version of vLLM? One sentence, with the source."}],
)
print(completion.choices[0].message.content)
- The model decides whether to search. Asking it to ("search the web", "check current sources") makes it more likely.
- Search results are added to the prompt, so these requests use more prompt tokens and take longer.
- The
x-obleth-boonsresponse header includesweb_searchwhen the add-on was active, and the headerx-obleth-boons: offon your request turns it off (see Gateway add-ons).
Related guides
- Chat completions: tools, add-ons and reasoning.
- Embeddings: search your own documents instead of the web.