DEV Community

Cover image for Should my AI agent use OpenAI's built-in web search or a separate search API?
Ricardo Batista for cloro

Posted on Edited on

Should my AI agent use OpenAI's built-in web search or a separate search API?

Use OpenAI's built-in web_search tool if your agent already runs on the Responses API, shows cited answers to a person, and runs few enough searches that $10 per 1,000 calls does not matter. Use a separate search API if you need to choose the index, read and filter the raw results, keep them, switch models, or pay less per call: most search APIs list $1 to $8 per 1,000 searches. Claude's and Gemini's built-in search tools have the same trade-offs, at $10 and $14 per 1,000 after their free allowances.

  • Price: OpenAI charges $10 per 1,000 calls plus the search content tokens at model rates. A separate API charges $1 to $8 per 1,000 at list price, and you still pay input tokens for the results you pass to the model.
  • Control: OpenAI's docs do not name the index behind the tool. You get the model's answer, inline citations and a sources list of URLs. A separate API gives you the full result JSON to filter, rerank, log and cache.
  • Lock-in: the built-in tool works only with OpenAI models. A search API is one HTTP call that any model or framework can use.

What does each option cost per 1,000 searches?

List prices for one real-time search in the default mode, read on November 16, 2026.

Option Per 1,000 searches Tokens for the results Free allowance
OpenAI web_search $10.00 "Search content tokens billed at model rates" None listed
Claude web search $10.00 "Standard token costs for search-generated content" None listed
Gemini Grounding with Google Search (Gemini 3 and newer) $14.00 Not stated in the grounding row 5,000 search requests a month
Serper $1.00 on the $50 pack of 50,000 credits Yours to pay when you pass results in 2,500 queries
Parallel $1.00 (fast) or $5.00 (advanced) Same Not stated
Brave $5.00 Same $5 of credit a month
Exa $7.00 (auto) or $4.00 (lite) Same $10 of credit a month
Tavily $8.00 pay as you go Same 1,000 credits a month
cloro, Google results $1.20 async, $2.00 sync, on Hobby Same 500 credits on the Free plan

The cloro row in numbers: the Hobby plan is $100 a month for 250,000 credits. A Google search is 3 credits, and a synchronous request adds 2, so 1,000 searches cost $1.20 async or $2.00 sync.

OpenAI's pricing page lists an older tier too: "Web search preview (other models) $25.00 / 1k calls + Search content tokens are free." The newer web_search tool is the $10 row.

Tokens matter on both sides. With the built-in tool, the search content is billed at the rate of the model you call. gpt-6-astra lists $10.00 per million input tokens and gpt-6-luna $0.10. With a separate API, you decide how much of the result goes into the prompt. In an open benchmark of six search APIs, the top 5 results gave the same accuracy as the top 10 with 35% fewer tokens, when the results included Google's AI Overview.

How much control do you keep over the results?

OpenAI web_search Separate search API
Which index Not named in the docs You choose: an own index (Brave, Exa, Parallel) or Google's live results (SerpApi, Serper, cloro)
What you get back The model's answer, inline citations, and sources, "the complete list of URLs the model consulted" The full result JSON: titles, URLs, snippets, and on Google SERP APIs the AI Overview and People Also Ask
Domain filter Up to 100 allowed_domains or 100 blocked_domains Depends on the API
Location Approximate user location: country, city, region, time zone Depends on the API; Google SERP APIs take a country and often a city
Cache-only mode external_web_access: false Your own cache, if the vendor's terms allow it
Context limit "The web search context window is limited to 128k" Whatever you pass in
Display rule You "must show inline citations as prominent, clickable links" Set by each vendor's terms
Models OpenAI models on the Responses API; gpt-5-search-api on Chat Completions Any model

The quotes in this table are from OpenAI's web search guide.

The control row that matters most for an agent is the second one. With the built-in tool, the model decides what to search, reads the results and writes the answer in one call. You see what it cited, but you cannot drop a result, add a source, or run a second check before the model answers. With a separate API, your code sits between the search and the model.

How fast is each option?

The open benchmark measured the search request alone, without the model, from one machine. The median was 0.74 seconds for Exa, 1.21 for Brave, 2.00 for Tavily and 2.99 for Parallel. The two Google SERP APIs, cloro and SerpApi, took about 8 seconds.

The built-in tools were not measured. Their latency includes the model's own reasoning and any repeated searches in one turn, so it is not comparable with a single search request. OpenAI's guide says only that unlimited result budgets "can increase latency and cost", and it suggests background mode "for reports that can take several minutes".

When is the built-in tool the better choice?

  • A prototype or a low-volume assistant. At a few hundred searches a month the price difference is a few dollars, and one fewer vendor is worth more.
  • A chat product that shows cited answers. The tool returns inline citations with their positions in the text, which is the part most teams build by hand.
  • An all-OpenAI stack. If you will not switch models, lock-in costs you nothing.

One limit shows up in low-code tools. In an n8n forum thread from July 2025, the AI Agent node did not expose OpenAI's native tool. The working answer was to call the OpenAI API from an HTTP Request node, or to attach a separate search tool such as SerpApi or Tavily to the agent.

When is a separate search API the better choice?

  • Volume. At 100,000 searches a month, $10 per 1,000 is $1,000 in call fees before tokens. The same volume costs $100 at $1 per 1,000.
  • More than one model. One search layer serves OpenAI, Claude, Gemini and open models alike.
  • A specific index. If the agent must see what Google shows, a Google SERP API returns that page. If it needs speed or independence from Google, Brave, Exa or Parallel do. OpenAI does not let you choose.
  • Audit and reuse. You can log every result, rerun a query, and test accuracy. The built-in tools were not part of the benchmark, so their accuracy on these question sets is not known.
  • Latency budget you control. You can set a timeout and fall back to a second API. A built-in call is one opaque step.

The two choices can also work together: a separate API for the agent's research loop, and the built-in tool for a final cited answer in a chat interface.

How this was checked

This comparison is published by cloro, which is one of the separate search APIs in the price table. OpenAI's, Anthropic's and Google's figures come from their own pricing and docs pages, and every other price from that vendor's pricing page, all read on November 16, 2026. cloro's row comes from its published plans. The latency and token figures come from the open benchmark linked above, whose harness is public. No built-in search tool was part of that benchmark.

Top comments (0)