Web Fetch
Enable LLMs to fetch and extract readable content from web pages.
Web Fetch is a built-in tool that allows LLMs to fetch and extract readable content from web pages. When enabled, the model can retrieve the contents of URLs to read articles, documentation, or any web page content.
Pricing
| Depth | Price |
|---|---|
| Basic | $4.00 / 1,000 calls |
| Advanced | $7.00 / 1,000 calls |
Each call gets up to 5 URLs. The cost is billed separately from token usage.
How it works
Include { type: 'web_fetch' } in your tools array to give the model the
ability to fetch web page contents. This is particularly useful when combined
with Web Search — first search for relevant URLs, then fetch their contents.
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.aivene.com/v1',
apiKey: process.env.AIVENE_API_KEY
});
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'Summarize the content of https://openai.com/index/gpt-4o/' }
],
tools: [
{ type: 'web_fetch' }
]
});
console.log(response.choices[0].message.content);Configuration options
typestringrequiredMust be "web_fetch".
extract_depthstringoptionalExtraction depth level. "basic" for standard extraction or "advanced" for
more comprehensive content parsing. Defaults to "basic".
Example with configuration
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'Read this technical documentation and explain the main concepts: https://example.com/docs' }
],
tools: [
{
type: 'web_fetch',
extract_depth: 'advanced'
}
]
});Fetch parameters
When the model decides to fetch pages, it can specify:
| Parameter | Type | Description |
|---|---|---|
urls | string[] | Array of URLs to fetch (max 5 per call) |
query | string | Optional query to focus extraction on specific content |
Combining Web Search and Web Fetch
The most powerful pattern is using both tools together. The model will search for relevant pages, then fetch the content of the most promising results:
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'user', content: 'Find and summarize the best practices for React Server Components' }
],
tools: [
{ type: 'web_search' },
{ type: 'web_fetch' }
]
});In this scenario, the model might:
- Search for "React Server Components best practices"
- Get a list of relevant URLs from the search results
- Fetch the content of the top results
- Synthesize the information into a comprehensive summary
Use cases
- Research assistance — Fetch multiple sources to compile information
- Documentation lookup — Read API docs or technical references
- Content summarization — Extract and summarize long articles
- Fact verification — Check claims by reading primary sources
Best practices
- Combine with Web Search — Use Web Search to find URLs, then Web Fetch to read them
- Limit URLs per call — The model can fetch up to 5 URLs at once
- Use query parameter — Help the extractor focus on specific content when pages are long
- Handle failures gracefully — Some URLs may fail to extract; the response includes both successes and failures