Skip to main content
Give your AI models access to real-time web data. Instead of relying on training data alone, models can search the web and ground their responses in current information.

What This Unlocks

  • Live web data — No more “I don’t know about recent events”
  • Current information — Break free from training cutoff dates
  • Automatic integration — Search results blend seamlessly into responses
  • Configurable depth — Control how much web context to include

How It Works

Add web_search_options to your API request. AnyAPI passes the search request to the model’s provider, which performs the web search and returns a response grounded in real-time data. The exact search mechanism depends on the provider — Anthropic uses its native web search tool, Google uses grounding with search, OpenAI uses its built-in search, and so on.

Chat Completions API

Basic Example

The web_search_options Parameter

Localized Search with user_location

Pass a location to get region-specific search results:
Python

Responses API

You can also use web search through the /v1/responses endpoint with the web_search_preview tool:

Search Context Levels

Real-World Examples

Latest News

Python

Deep Research with Perplexity

Python

Reasoning Over Web Results

Python

Supported Models

Web search works with 800+ models on AnyAPI, including: Check the model database for the full list of models with web search support.

Pricing

Web search incurs an additional per-search cost on top of regular token pricing. The exact cost depends on the model and provider.

Pro Tips

  1. Match context to your needs: Quick questions = "low", research = "high"
  2. Be specific in your prompts: “Tesla Q4 2025 earnings” beats “stock market”
  3. Use with reasoning models: Models like o3, DeepSeek R1, and Claude with extended thinking can reason over web results for deeper analysis
  4. Use Perplexity for research: Sonar models are built for search and return citations by default

Things to Keep in Mind

  • Slight latency: Web search adds a moment to response time
  • Cost scaling: Higher search_context_size uses more tokens and increases cost
  • Rate limits: Standard rate limits apply to requests with web search

Give your AI models internet access. Web search turns any model into a research assistant that knows what happened five minutes ago.