Skip to main content

Overview

The fetch_url tool fetches and extracts content from specific URLs. Use it when you need the full content of a particular web page, article, or document rather than search results.

Pricing

URL fetch costs $0.50 per 1,000 requests ($0.0005 per fetch). You’re also charged for tokens consumed when fetched content is embedded in the model’s context.
If a model fetches 2 URLs with 3,000 tokens of content, plus your original 80-token query, using anthropic/claude-sonnet-4-5:
ComponentCalculationCost
Tool calls2 fetches × $0.0005$0.001
Input tokens3,080 tokens × $3.00/1M$0.00924
Output tokens500 tokens × $15.00/1M$0.0075
Total$0.01774

Basic Usage

from perplexity import Perplexity

client = Perplexity()

response = client.responses.create(
    model="openai/gpt-5.2",
    input="Summarize the content at https://example.com/article",
    tools=[
        {
            "type": "fetch_url"
        }
    ],
    instructions="Use fetch_url to retrieve and summarize the article."
)

print(response.output_text)

Use Cases

Article Summarization

Fetch and summarize specific articles or blog posts.

Documentation Analysis

Extract and analyze technical documentation.

Content Comparison

Compare content from multiple specific URLs.

URL Validation

Verify content at specific URLs before sharing.
Use fetch_url together with web_search for comprehensive information gathering—search to find relevant pages, then fetch full content from the most relevant results:
from perplexity import Perplexity

client = Perplexity()

response = client.responses.create(
    model="openai/gpt-5.2",
    input="Find recent articles about quantum computing and summarize the top result",
    tools=[
        {
            "type": "web_search",
            "filters": {
                "search_recency_filter": "week"
            }
        },
        {
            "type": "fetch_url"
        }
    ],
    instructions="First use web_search to find recent articles, then use fetch_url to retrieve the full content of the most relevant article and provide a detailed summary."
)

print(response.output_text)

Best Practices

Use fetch_url when…Use web_search when…
You have a specific URLYou need to find relevant pages
You need full page contentYou need snippets from multiple sources
Analyzing a particular documentResearching a broad topic
Verifying specific claimsFinding current news or events

Effective Instructions

Guide the model on when to fetch URLs:
instructions = """You have access to web_search and fetch_url tools.

Use fetch_url when:
- You need detailed content from a specific URL
- You want to analyze a particular article or document
- You need to verify specific claims from a URL

Use web_search first to find URLs, then fetch_url to get full content."""

Next Steps