This feature is in public preview. To use it, opt in from the Feature Preview page.
How to Use Web Searchpublic
Last verified 24 Aug 2026
Inference provides a single control plane for managing inference workflows. It includes a Model Catalog where you can view available foundation models, including both DigitalOcean-hosted and third-party commercial models, compare model capabilities and pricing, use routing to match inference requests to the best-fit model, and run inference using serverless or dedicated deployments.
Web search is a built-in tool that gives the model access to real-time web content during inference. When you add web search in your API request, the model decides when a web search is needed, and the results are incorporated into the model’s response.
We use a third-party web search service (Exa.ai) for all models.
To enable web search, include a tool object with type set to web_search in the tools array of your request. When the model determines that a prompt benefits from web search, it searches for relevant information and incorporates the results into its response.
The following examples send Responses API requests with web search enabled:
import os
from pydo.inference import Client
client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))
resp = client.responses.create(
model="openai-gpt-4o",
input="What are the latest pricing changes for DigitalOcean Droplets?",
tools=[
{
"type": "web_search",
"max_uses": 3,
"max_results": 5,
}
],
max_output_tokens=1024,
stream=False,
)
print(resp)import { InferenceClient } from "@digitalocean/dots";
const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});
const resp = await client.responses.create({
model: "openai-gpt-4o",
input: "What are the latest pricing changes for DigitalOcean Droplets?",
tools: [
{
type: "web_search",
max_uses: 3,
max_results: 5,
},
],
max_output_tokens: 1024,
stream: false,
});
console.log(resp);curl -X POST https://inference.do-ai.run/v1/responses \
-H "Authorization: Bearer $MODEL_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai-gpt-4o",
"input": "What are the latest pricing changes for DigitalOcean Droplets?",
"tools": [
{
"type": "web_search",
"max_uses": 3,
"max_results": 5
}
],
"max_output_tokens": 1024,
"stream": false
}'Alternatively, specify model: <model_name>:web to enable model access to web search and web fetch. This is particularly useful in coding agents where you can only change the model name.
You can optionally limit the number of searches the model performs per request from 1 to 5 with max_uses and the number of results each search returns from 1 to 10 with max_results (defaults to 5). When the request reaches the limit, the model produces a final response using the results collected so far. For the full set of web search parameters, see the Serverless Inference API reference.
The response looks similar to the following:
{
...
"output": [
{
"action": {
"queries": [
"DigitalOcean AI platform features"
],
"query": "DigitalOcean AI platform features",
"type": "search"
},
"id": "ws_call_t7eyYNbAWQOcEln1Ns2TxuOv",
"status": "completed",
"type": "web_search_call"
},
{
"content": [
{
"annotations": [
{
"end_index": 1501,
"start_index": 1439,
"title": "DigitalOcean AI Platform Features | DigitalOcean Documentation",
"type": "url_citation",
"url": "https://docs.digitalocean.com/products/inference/details/features"
},
{
"end_index": 1800,
"start_index": 1729,
"title": "DigitalOcean Inference Details | DigitalOcean Documentation",
"type": "url_citation",
"url": "https://docs.digitalocean.com/products/inference/details"
},
{
"end_index": 2085,
"start_index": 2028,
"title": "Agent Platform | Build AI Agents with DigitalOcean",
"type": "url_citation",
"url": "https://www.digitalocean.com/products/inference/platform"
}
],
"logprobs": [],
"text": "The DigitalOcean AI Platform offers a variety of features:\n\n1. **AI Agent Development**: Build fully-managed AI ...",
"type": "output_text"
}
],
...
}
}