Web Fetch
Beta
Server tools are currently in beta. The API and behavior may change.
The openrouter:web_fetch server tool gives any model the ability to fetch
content from a specific URL. When the model needs to read a web page or PDF
document, it calls the tool with the URL. OpenRouter fetches and extracts the
content, returning text that the model can use in its response.
How It Works
- You include
{ "type": "openrouter:web_fetch" }in yourtoolsarray. - Based on the user’s prompt, the model decides whether it needs to fetch a URL and generates the request.
- OpenRouter fetches the URL using the configured engine (defaults to
auto, which uses native provider fetch when available or falls back to Exa). - The page content (text, title, and URL) is returned to the model.
- The model incorporates the fetched content into its response. It may fetch multiple URLs in a single request if needed.
Quick Start
Configuration
The web fetch tool accepts optional parameters to customize behavior:
Engine Selection
The web fetch server tool supports multiple fetch engines:
auto(default): Uses native fetch if the provider supports it, otherwise falls back to Exanative: Forces the provider’s built-in web fetchexa: Uses Exa’s Contents API to extract page content (supports BYOK)openrouter: Uses direct HTTP fetch with content extractionfirecrawl: Uses Firecrawl’s scrape API (BYOK — bring your own key)
Engine Capabilities
Firecrawl (BYOK)
Firecrawl uses your own API key. To set it up:
- Go to your OpenRouter plugin settings and configure your Firecrawl API key
- Your Firecrawl account is billed separately from OpenRouter
Hard Limits
To prevent runaway costs:
- Exa engine: No hard limit (billed via API credits)
- Firecrawl engine: No hard limit (uses your Firecrawl credits)
- OpenRouter/native engines: Hard limit of 50 fetches per request
Domain Filtering
Restrict which domains can be fetched using allowed_domains and
blocked_domains:
When allowed_domains is set, only URLs from those domains will be fetched.
When blocked_domains is set, URLs from those domains will be rejected.
Content Truncation
Use max_content_tokens to limit the amount of content returned:
Content exceeding this limit is truncated. This is useful for controlling context window usage when fetching large pages.
Works with the Responses API
The web fetch server tool also works with the Responses API:
Response Format
When the model calls the web fetch tool, it receives a response like:
If the fetch fails, the response includes an error:
Pricing
All pricing is in addition to standard LLM token costs for processing the fetched content.
Exa BYOK
If you configure your own Exa API key in your provider settings, web fetches using the Exa engine are free through OpenRouter — you pay Exa directly.
Next Steps
- Server Tools Overview — Learn about server tools
- Web Search — Search the web for real-time information
- Datetime — Get the current date and time
- Tool Calling — Learn about user-defined tool calling