---
title: How to Use Web Fetch (public)
description: Add the DigitalOcean-hosted web fetch tool to Inference requests so models can retrieve full web page and PDF content during a turn.
product: Inference
url: https://docs.digitalocean.com/products/inference/how-to/use-server-side-tools/use-web-fetch/
last_updated: "2026-10-16"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Use Web Fetch (public)

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.

**Note**:

  This feature is in [public preview](https://docs.digitalocean.com/platform/product-lifecycle/index.html.md#public-preview). To use it, opt in from the [**Feature Preview** page](https://cloud.digitalocean.com/account/feature-preview).

Web fetch is a DigitalOcean-hosted tool that retrieves the full content of specific web pages and PDF documents during inference. When you add web fetch to your API request, the model fetches URLs referenced in the conversation and incorporates the content into its response. We use a third-party web fetch service (Exa.ai) for all non-Anthropic models. For Anthropic models, web fetch is a provider passthrough tool with a different schema (see [Web Fetch with Anthropic Models](https://docs.digitalocean.com/products/inference/how-to/use-server-side-tools/use-provider-agentic-tools/index.html.md#web-fetch-with-anthropic-models)).

To enable web fetch, include a tool object with `type` set to `web_fetch` in the `tools` array of your request. The following example sends a Responses API request with web fetch enabled:

### Python

```python
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="Summarize the content at https://docs.digitalocean.com/products/inference/",
    tools=[
        {
            "type": "web_fetch",
            "max_uses": 3,
        }
    ],
    max_output_tokens=1024,
    stream=False,
)

print(resp)
```

### JavaScript

```javascript
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: "Summarize the content at https://docs.digitalocean.com/products/inference/",
    tools: [
        {
            type: "web_fetch",
            max_uses: 3,
        },
    ],
    max_output_tokens: 1024,
    stream: false,
});

console.log(resp);
```

### cURL

```shell
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": "Summarize the content at https://docs.digitalocean.com/products/inference/",
    "tools": [
      {
        "type": "web_fetch",
        "max_uses": 3
      }
    ],
    "max_output_tokens": 1024,
    "stream": false
  }'
```

### Go

```go
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("MODEL_ACCESS_KEY"))
	ctx := context.Background()

	resp, _, err := client.Responses.New(ctx, &godo.ResponseNewParams{
		Model: "openai-gpt-4o",
		Input: "Summarize the content at https://docs.digitalocean.com/products/inference/",
		Tools: []godo.ResponseTool{
			godo.WebFetchTool(godo.PtrTo(3)),
		},
		MaxOutputTokens: godo.PtrTo(1024),
	})
	if err != nil {
		panic(err)
	}

	fmt.Println(resp.OutputText())
}
```

You can optionally limit the number of fetches the model performs per request from 1 to 5 with `max_uses`. When the request reaches the limit, the model produces a final response using the content collected so far.

Alternatively, specify `model: <model_name>:web` to give the model access to web fetch and web search. This is particularly useful for coding agents where you can only change the model name.