Blog

Engineering updates and practical guides

All posts
Tutorials

Web Search & URL Fetching: Real-Time Context for AI

How RoutePlex automatically detects when your prompt needs web search or URL fetching — no extra parameters needed.

RoutePlex Team
February 12, 20264 min read
Web Search & URL Fetching: Real-Time Context for AI

Web Search & URL Fetching: Real-Time Context for AI

AI models have a knowledge cutoff. They can't tell you today's weather, check a live webpage, or reference a document you just published. RoutePlex solves this with two built-in capabilities: web search and URL fetching.

The best part? Both are fully automatic. You don't need to set any flags or parameters — RoutePlex detects when your prompt needs real-time data and handles everything behind the scenes.

Web Search — Auto-Detected

When your prompt asks about current events, live data, or anything that requires up-to-date information, RoutePlex's detection system automatically triggers a web search before passing context to the AI model.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.routeplex.com/v1",
    api_key="rp_live_your_key"
)

# Web search triggers AUTOMATICALLY — no extra params needed
response = client.chat.completions.create(
    model="routeplex-ai",
    messages=[{
        "role": "user",
        "content": "What are the top AI news stories today?"
    }]
)

print(response.choices[0].message.content)

RoutePlex scans your prompt for real-time indicators — phrases like "latest news", "current price", "today", "right now", year references (2025, 2026), and many more patterns. When detected, a web search runs in parallel with request processing.

What Triggers Web Search

The detection system looks for:

  • Time-sensitive phrases — "right now", "as of today", "latest", "current"
  • News & events — "breaking news", "recent news", "who won"
  • Financial data — "stock price", "exchange rate", "market cap"
  • Sports — "match score", "game score", "live score"
  • Weather — "weather in", "temperature", "forecast"
  • Year references — Mentions of 2024-2030 in context that implies recency

Web Search Cost

Each web search costs $0.002. This is added to your normal token costs. The search results are injected as context into the prompt, so you'll also see a small increase in input tokens.

URL Fetching — Auto-Detected

When your prompt contains a URL (any https:// link), RoutePlex automatically fetches the page content, extracts the text, and includes it in the model's context window. No configuration needed.

# URL fetching triggers AUTOMATICALLY when URLs are in the prompt
response = client.chat.completions.create(
    model="routeplex-ai",
    messages=[{
        "role": "user",
        "content": "Summarize the key points from this page: https://example.com/article"
    }]
)

This works with any publicly accessible URL — documentation pages, blog posts, articles, API docs, GitHub READMEs, and more.

URL Fetching Cost

URL fetching is free — no additional cost beyond the extra input tokens from the fetched content.

URL Safety

All URLs pass through RoutePlex's moderation pipeline before fetching. Dark web domains (.onion, .i2p), known malware hosts, and blocklisted domains are automatically blocked. URL shorteners are flagged but allowed.

When to Use Each

| Feature | Triggers When | Best For | Cost | |---------|---------------|----------|------| | Web Search | Time-sensitive language in prompt | Current events, live data, fact-checking | $0.002/search | | URL Fetching | URLs detected in prompt | Specific documents, articles, docs | Free |

Both Can Fire Together

If your prompt contains a URL AND time-sensitive language, both tools fire simultaneously:

response = client.chat.completions.create(
    model="routeplex-ai",
    messages=[{
        "role": "user",
        "content": "Compare the latest AI benchmarks with what's shown on https://example.com/benchmarks"
    }]
)

In this case, RoutePlex runs a web search for "latest AI benchmarks" AND fetches the URL content, then combines both into the model's context.

Cost Estimation

Use the /chat/estimate endpoint to preview costs before making a request — this is free and doesn't count toward your usage:

curl https://api.routeplex.com/api/v1/chat/estimate \
  -H "Authorization: Bearer rpx_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "routeplex-ai",
    "messages": [{"role": "user", "content": "What is the weather in NYC?"}]
  }'

Available on All Plans

Web search and URL fetching are available on every plan, including the free Evaluation tier. They're part of what makes RoutePlex more than just a proxy — it's an intelligent gateway that enhances what AI models can do.

Get started for free →