What Web Search Costs in the OpenAI, Claude, Gemini and Perplexity APIs

Built-in web search for LLMs, priced side by side: OpenAI's web search tool, Claude's web search tool, Gemini grounding with Google Search and Perplexity Sonar, with the token costs most comparisons leave out and a worked monthly bill.

Short answer: OpenAI's and Anthropic's built-in web search tools each cost $10 per 1,000 searches, plus tokens for the results the model reads. Gemini's grounding with Google Search gives 5,000 free prompts a month on Gemini 3 models, then $14 per 1,000 search queries, and doesn't bill the retrieved content as input tokens. Perplexity's Sonar Pro charges tokens plus a request fee of $6 to $14 per 1,000, depending on how much search context you ask for. A separate search API, whose results you pass to any model yourself, runs $0.25 to about $5 per 1,000 searches, plus only the tokens you choose to send. At scale, that difference is usually the biggest line on an agent's bill.

Search fee Retrieved content billed as tokens? Free allowance How you turn it on
OpenAI web search tool $10 per 1,000 calls Yes, at the model's input rate None tools: [{ type: "web_search" }]
Claude web search tool $10 per 1,000 searches Yes, normal token rates None web_search server tool
Gemini 3 grounding with Google Search $14 per 1,000 search queries No 5,000 prompts a month google_search tool
Gemini 2.5 grounding $35 per 1,000 grounded prompts No 1,500 requests a day google_search tool
Perplexity Sonar Pro $6–$14 per 1,000 requests (by context size) Tokens at $3 in / $15 out per million None every call searches
Perplexity Search API $5 per 1,000 requests No tokens, raw results None /search endpoint
A search API (e.g. browserfoundry) $0.25–$2.40 per 1,000 Only what you pass to your model 1,250 credits a month call it, then prompt any model

Prices are each provider's published list rates in October 2026; sources are at the end.

Why the sticker price isn't the bill

The per-search fee is the part everyone compares. It's also the part that misleads, because three other things quietly multiply it:

  1. The model decides how often to search. One user question can trigger two, three, five searches. Each is billed. You don't get a vote unless you cap it.
  2. What the model reads is billed too. With OpenAI and Claude, search results come back as input tokens, often thousands per search, at your model's input price. On a large model, the tokens can cost more than the search.
  3. Agents loop. Search, think, search again, read a page, search once more. Every step pays both meters.

So the number to compare is cost per answered question, not cost per search.

Rule of thumb. Multiply the per-search fee by your real average number of searches per question, then add the tokens. Log it for a week before you trust anyone's pricing table, including this one.

OpenAI: the web search tool

In the Responses API, add the web_search tool and the model searches when it decides it needs to, returning an answer with cited sources:

from openai import OpenAI

client = OpenAI()
response = client.responses.create(
    model=MODEL,  # any model that supports web search
    tools=[{"type": "web_search"}],
    input="What changed in the EU AI Act enforcement timeline this year?",
)
print(response.output_text)

Pricing: $10 per 1,000 tool calls, plus the search content tokens billed at the model's input rate. The older web_search_preview tool is priced differently, so check OpenAI's pricing page for the tool version and model you use.

Claude: the web search tool

Claude's web search is a server tool: you list it, Claude runs the searches and cites what it used. max_uses caps searches per request, and it's the most useful cost control in this whole post:

import anthropic

client = anthropic.Anthropic()
message = client.messages.create(
    model=MODEL,
    max_tokens=1024,
    tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}],
    messages=[{"role": "user", "content": "What changed in the EU AI Act enforcement timeline this year?"}],
)

Pricing: $10 per 1,000 searches, plus normal token costs for the results Claude reads. Check Anthropic's docs for the current tool version string.

Gemini grounds answers in Google Search when you add the google_search tool, and returns grounding metadata that links each claim to its source:

from google import genai
from google.genai import types

client = genai.Client()
response = client.models.generate_content(
    model=MODEL,
    contents="What changed in the EU AI Act enforcement timeline this year?",
    config=types.GenerateContentConfig(tools=[types.Tool(google_search=types.GoogleSearch())]),
)
print(response.text)

Pricing on Gemini 3 models: 5,000 grounded prompts a month free (shared across the family), then $14 per 1,000 search queries. Read that unit carefully: one prompt can run several queries, and each query counts. On Gemini 2.5 models: 1,500 grounded requests a day free, then $35 per 1,000 grounded prompts. The nice part: the retrieved content is not billed as input tokens.

Gotcha. Gemini's free tier is generous enough to hide the real cost during a prototype. Run your expected production volume through the math before you launch, not after the first invoice.

Perplexity: Sonar

Every Sonar call searches the web, so there's no tool to switch on. You choose how much search context to pull in, and that sets the request fee:

import os, requests

r = requests.post(
    "https://api.perplexity.ai/chat/completions",
    headers={"Authorization": f"Bearer {os.environ['PERPLEXITY_API_KEY']}"},
    json={
        "model": "sonar-pro",
        "messages": [{"role": "user", "content": "What changed in the EU AI Act enforcement timeline this year?"}],
        "web_search_options": {"search_context_size": "low"},
    },
    timeout=60,
)

Pricing: tokens ($1 in and $1 out per million on Sonar; $3 in and $15 out on Sonar Pro) plus a request fee by context size, from $6 per 1,000 at low to $14 at high on Sonar Pro. Perplexity also sells a Search API returning raw results at $5 per 1,000 requests with no token charge. Worth knowing: Perplexity now describes the Sonar API as in maintenance mode and recommends its Agent API for new integrations.

The do-it-yourself pattern

The alternative is to keep search outside the model. Your code calls a search API, picks what the model should see, and puts it in the prompt:

import os, requests
from openai import OpenAI

def search(q, n=5):
    r = requests.post(
        "https://api.keirolabs.cloud/api/v2/search/fast",
        headers={"Authorization": f"Bearer {os.environ['KEIRO_API_KEY']}"},
        json={"query": q, "maxResults": n},
        timeout=30,
    )
    r.raise_for_status()
    return r.json()["results"]

question = "What changed in the EU AI Act enforcement timeline this year?"
context = "\n".join(f"[{i+1}] {x['title']} ({x['url']}): {x['snippet']}" for i, x in enumerate(search(question)))

answer = OpenAI().responses.create(
    model=MODEL,  # or any other provider's model; the search doesn't care
    input=f"Answer using only these sources and cite them by number.\n\n{context}\n\nQuestion: {question}",
)
print(answer.output_text)

Five snippets is a few hundred tokens instead of thousands. Need more depth? Send full pages for the top two results only. You choose, per question.

When snippets aren't enough

For research questions where the answer is buried deep in a page, browserfoundry's Deep Search (POST /api/v2/deep) searches, crawls every top result in full, and orders the results by how likely each page is to contain the answer. Each result carries a ~700-character excerpt (the passage most likely to answer) plus the full page text, so one call often replaces a search plus several scrapes. It costs 5 credits per call on every plan and takes 15 to 50 seconds, so set your client timeout to at least 120 seconds. Read the excerpts first: they answer most questions for a fraction of the tokens.

A worked monthly bill

Take an agent answering 1,000 questions a day (30,000 a month), with one search per question. Assume the model reads about 2,000 tokens of results per search, and price input at $1 per million tokens, a typical small-model rate. These are assumptions, so swap in your own. Answer tokens are left out because they're the same on every option.

Setup Search fees Tokens for the results Monthly total
OpenAI web search tool $300 $60 (60M tokens) about $360
Claude web search tool $300 $60 (60M tokens) about $360
Gemini 3 grounding $350 (25,000 billable after 5,000 free) $0 about $350
Perplexity Sonar Pro, low context $180 prompt tokens at $3 per million $180 + tokens
browserfoundry search, 500 tokens of snippets $50 (Pro plan, 37,500 credits) $15 (15M tokens) about $65

Now make it realistic: agents average three searches per question. The built-in rows roughly triple to around $1,000+ a month. The search-API row grows by the search fee and the extra snippets you choose to send, and with /api/v2/search/slow (free and unlimited on paid plans) for background work that can wait, part of the volume costs nothing extra.

The gap comes from two places: the search fee itself, and control over what the model reads.

When the built-in tools are worth it

  • You're committed to one model and want grounded, cited answers without building retrieval.
  • Volume is low. At a few hundred questions a month the fees are noise, and Gemini's free allowance may cover you entirely.
  • You want the model to decide when to search. Built-in tools handle that loop for you, and that's real engineering time saved.

When a separate search API wins

  • High volume, where $10 per 1,000 searches plus tokens dominates the bill.
  • You switch or route between models and want search to behave the same everywhere.
  • You want to control what the model reads: snippets only, the top three pages, or full pages converted to markdown.
  • You need the same search in your app, not just inside a chat. A search API is just an API: call it from a cron job, a backend, an agent or a spreadsheet.

If you're replacing a deprecated search API at the same time, see what to use instead of Google's Custom Search API or why the free DuckDuckGo library breaks.

How we put this together

Prices come from each provider's published pricing and documentation as of October 2026: OpenAI API pricing, Anthropic's web search tool docs, Gemini API pricing and grounding docs, Perplexity pricing, and browserfoundry's pricing and API docs. The monthly bills are arithmetic on those list prices under the stated assumptions, not measurements. Model token prices vary widely and change often, so plug in your own model's rate.

FAQ

How much does the OpenAI web search API cost?

OpenAI's web search tool is billed per call, $10 per 1,000 searches, plus the retrieved search content as input tokens at the model's rate. Check OpenAI's pricing page for the rate on your model and tool version.

How do I enable web search in the ChatGPT API?

Add the web_search tool to a Responses API request, for example tools: [{ type: "web_search" }]. The model decides when to search and returns cited sources with its answer.

How much does Claude's web search cost?

Anthropic charges $10 per 1,000 searches for Claude's web search tool, plus normal token costs for the search results the model reads.

How much does Gemini grounding with Google Search cost?

On Gemini 3 models, 5,000 grounded prompts a month are free, then $14 per 1,000 search queries; one prompt can run several queries. Gemini 2.5 uses an older scheme: 1,500 free requests a day, then $35 per 1,000 grounded prompts.

Is it cheaper to use a separate search API?

Often. A search API returns results you pass to any model yourself, so you pay the search price plus only the tokens you choose to send. On published rates that ranges from $0.25 to about $5 per 1,000 searches, against $10 to $14 for the built-in tools before tokens.

Keep reading
Search APIs

Google Custom Search API Is Shutting Down: What to Use Instead

Search APIs

DuckDuckGo Search API: Is It Free, What Are the Limits, and What to Use Instead

Extraction

URL to Markdown for LLMs: 7 Ways to Do It, Compared