Enable web search
Add a tool with typeweb_search to tools. The API also accepts web_search_2025_08_26, web_search_preview, and web_search_preview_2025_03_11, which give the model the same tools.
A web search tool gives the model three tools. The model decides when to call each one:
Inspect the
web_search_call items in the response output to see each query and URL the model requested.
This request asks a question that needs current information:
Tool options
For the full schema, see Create a response.
What the provider receives
All web search traffic goes from the MKA1 platform to the provider over HTTPS. Your end users’ devices don’t contact the provider, so the provider doesn’t see their IP addresses.Searches
Eachweb_search call sends one request to google.serper.dev with these fields:
The model writes the query from the conversation. A query can therefore include text from the input or instructions, such as a name, a product, or a place the user mentioned.
Page reads
Eachscrape or web_find call sends the URL the model chose to scrape.serper.dev. Serper fetches the page and returns its text. For web_find, the MKA1 platform matches the pattern against that text itself; the pattern isn’t sent to the provider.
Country lookups
If the model sets a country that isn’t a two-letter code or a country name the API recognizes, the API sends that country text to the public SerpApi Locations API (serpapi.com/locations.json) to find its country code. The lookup request contains only the country text and a result limit of 1. If the lookup fails or finds nothing, the search uses us.
What isn’t sent
The platform doesn’t forward your MKA1 authentication headers or identity headers such asX-On-Behalf-Of to these providers. It doesn’t add organization, team, or user identifiers from the request context to provider payloads. It authenticates to Serper with the cluster’s own Serper key, and country lookups carry no key.
The platform doesn’t send the conversation, instructions, or files as separate payloads. However, the model can copy their contents into a query, URL, location, language, or country value. Those values are sent without redacting credentials or identifiers they contain. For example, a page URL can contain an access token or user ID in its query string, even when its domain is allowed. URLs that carry credentials before the host (user:password@) are refused when a domain list is set.
Separately from the provider, the MKA1 platform records each web search tool call on the cluster. The call’s arguments (query, URL, pattern, location, language, and country) and its output (search results, page text, or matching lines) are written to the platform audit log and, in shortened form, to request traces. The web_search_call items in the response output carry the query, URL, and pattern, and are stored with the response when the response is stored. Serper sees the cluster’s outbound IP address, not your end users’.
Caching
Search results aren’t cached. Eachweb_search call sends a new request to the provider.
Page text from scrape and web_find is cached on the platform for 5 minutes. The cache key is the URL alone, so the cache is shared by all callers on the cluster. A repeat read of the same URL within that window doesn’t send a new request to the provider. The domain list and network policy checks still run before the cache is read.
Usage and billing
Eachweb_search call counts as one search. Each scrape or web_find call that isn’t served from the cache also counts as one search. Searches are priced under the serper price entry, and their cost counts toward budgets. Country lookups aren’t billed.
Restrict web search to specific domains
Setfilters.allowed_domains to limit web search to a list of domains. The filters field is available on web_search and web_search_2025_08_26. A request that sets filters on a web_search_preview type fails with HTTP 400.
Write each entry as a hostname, such as python.org, and omit the scheme. If an entry starts with http:// or https:// or ends with /, the API removes that part. Each entry also covers its subdomains: python.org covers docs.python.org but not notpython.org. Matching ignores case.
A list can have up to 100 entries. A request with an entry that contains a path, a query string, a port, credentials, an IP address, or a wildcard, or whose hostname has no dot (such as localhost), fails with HTTP 400. A filters object with an unknown key, such as allowedDomains, also fails with HTTP 400. An empty or omitted list leaves web search unrestricted.
With a domain list set:
- The API removes search results that aren’t on the listed domains, so the model can receive fewer results than
search_context_sizerequests. scrapeandweb_findrefuse URLs outside the listed domains before sending anything to the provider, and the model receives an error for that call.- The API removes URL citations (
url_citationannotations) that point outside the listed domains from the output. - Each search runs at most 4 provider searches, each counted as a search. A long list is split across those searches in the order you give it. If the list doesn’t fit, the API runs 3 searches restricted to the first domains plus one unrestricted search filtered to the whole list, so later domains can still appear but less reliably. Put the most important domains first.
web_search, scrape, and web_find only. Other tools in the same request, such as shell, code_interpreter, mcp, and OpenAPI tools, can still reach other hosts. Use outbound network policies to restrict where a request can connect.
Outbound network policies
If the cluster enforces outbound network policies and your organization or team has a policy that restricts destinations, web search traffic must pass that policy:- Allow
google.serper.devfor searches andscrape.serper.devfor page reads. Allowserpapi.comif the model may need country lookups. - Each URL that the model asks
scrapeorweb_findto read must also be allowed. A URL outside the policy fails and the model receives an error for that call. With a policy in force, URLs with a port other than 80 or 443, or whose host is an IP address, are refused as well. - If the policy can’t be verified, outbound requests are refused.
Availability on a cluster
Web search is available only when the cluster operator has configured a Serper API key (SERPER_API_KEY). On a cluster without one, a Responses request that includes any web search tool fails with HTTP 400 and the error code feature_unavailable. The error’s service field is web_search and its param field names the tool, for example tools[0].type. Requests without a web search tool aren’t affected.
In a batch, the affected item fails with code: feature_unavailable instead.