DEV Community

Cover image for Is there a Google search API built for RAG pipelines?
Ricardo Batista for cloro

Posted on

Is there a Google search API built for RAG pipelines?

Google sells search for RAG, but no Google API gives your pipeline Google's live web results as data. Agent Search, the new name of Vertex AI Search, searches only the documents and sites that you index. Grounding with Google Search searches the web, but it gives you a Gemini answer with citations instead of the result list. The Custom Search JSON API returns results, but it is closed to new customers and stops on January 1, 2027. To put Google's web results into your own retriever and prompt, use a Google SERP API.

  • Your own data: Agent Search or Gemini File Search. Both index your content and retrieve from it. Neither searches the open web.
  • Web answers inside Gemini: Grounding with Google Search. Google's terms do not let you store the grounded results, build an index from the links, or mix other content into them.
  • Web results as data, for any model: a Google SERP API. It returns the organic results, the AI Overview and People Also Ask as JSON. With one Google search per question, a model answered 96.9% of SimpleQA Verified questions.

What does Google offer for a RAG pipeline?

Option Searches Returns to your code Price
Agent Search (Vertex AI Search) Documents, data or websites in your data store Ranked results from your store; generated answers on Enterprise $1.50 per 1,000 queries on Standard, $4.00 on Enterprise; 10,000 free a month
Gemini File Search Files that you upload Gemini's answer, with citations to your files Indexing $0.15 per 1M tokens; storage free
Grounding with Google Search Google Search, inside a Gemini call Gemini's answer, its queries, cited URLs and titles 5,000 free search requests a month, then $14 per 1,000
Custom Search JSON API A Programmable Search Engine Results with title, link and snippet $5 per 1,000 after 100 free a day; closed to new customers, ends January 1, 2027
Google SERP API (third party) The live Google results page Organic results, AI Overview and People Also Ask as JSON About $2 to $6 per 1,000, by vendor

Two things separate these options: what each one searches, and what it gives back. A RAG pipeline needs text with a source URL that it can rank, cache and put into a prompt for any model.

Is Vertex AI Search a Google search API?

Not for the web. Google is renaming Vertex AI Search to Agent Search, and the Cloud console still uses the old name. It is a search engine that you fill: you create a data store from documents, structured data or a list of websites, and it retrieves from that store. Website search needs Enterprise edition. The Custom Search overview recommends it "for searching up to 50 domains", and the migration guide calls it "site-restricted search".

The builder APIs, the Google page that AI engines read most for this question, are parts for a RAG pipeline that you assemble: a layout parser for chunks, embeddings, Vector Search, a Ranking API, grounded generation and check grounding. Grounded generation can ground on Google Search, but it returns an answer with references and no result list.

The Ranking API works with any retriever. Google bills a ranking query of up to 100 documents at $1.00 per 1,000 queries, so it can also rerank web results from a different source.

What does Grounding with Google Search return?

It returns a Gemini answer. You add the Google Search tool to a Gemini API call, and the model searches, reads the results and writes the answer. The documented response holds the queries that the model ran, citations with a URL and a title for parts of the answer text, and an HTML snippet for Search Suggestions. The documentation does not show a result list, snippets or page text that your code can use.

The terms decide most of the RAG question. The Gemini API Additional Terms (effective March 23, 2026) say that you must show grounded results with their Search Suggestions to the end user who sent the prompt. You may not store grounded results, except their text for up to two years for uses such as chat history. You may not build an index from the links, mix other content into the results, or train on them.

Grounding fits a Gemini app that shows a grounded answer to a user. It does not fit a pipeline that retrieves, reranks and caches results for a model of your choice.

Pricing: on Gemini 3 and newer models, 5,000 search requests a month are free, then $14 per 1,000 search requests. Google bills each search query that the model runs, so one prompt can cost more than one request. The default limit on the paid tier is 1,500 requests a day per project.

Gemini File Search is the other RAG tool in the Gemini API. It retrieves from files that you upload, not from the web, and it "cannot be combined with other tools" such as Grounding with Google Search at this time.

Can you still use the Custom Search JSON API?

Only if you already have access. Google's overview says that the API "is closed to new customers" and that existing customers "have until January 1, 2027 to transition to an alternative solution". A RAG pipeline that you build on it today works for less than two months. The migration options are in a separate post.

How does a Google SERP API fit a RAG pipeline?

A SERP API runs the query on Google and returns the results page as JSON: organic results with title, link and snippet, the AI Overview as text, and People Also Ask. Your code owns that output: you can rank it, cache it, mix it with your own chunks and send it to any model. SerpApi, DataForSEO and cloro are examples.

There are two pipeline shapes:

  1. Search first. Your code runs one search per question and puts the top results into the prompt.
  2. Tool calling. The model gets a search tool and calls it when it needs it.

With LangChain, a Google search tool is one package. This is the tool-calling shape:

from langchain.agents import create_agent
from langchain_cloro import CloroGoogleSearch

search = CloroGoogleSearch()  # reads the API key from the environment

agent = create_agent(
    model="openai:gpt-5.6-luna",
    tools=[search],
    system_prompt=(
        "Search the web for facts that may have changed. "
        "Search at most 3 times. Cite the URL of every result you use."
    ),
)
Enter fullscreen mode Exit fullscreen mode

For the search-first shape, your code calls search.invoke({"query": question, "include_aioverview": True}) and puts the results into the prompt.

In a public benchmark of six web search APIs, each API ran one search per question, and the same model read each set of results:

  • Accuracy at the top is close. On SimpleQA Verified, Parallel scored 97.8%, Exa 97.3% and the top Google SERP API 96.9%, within the margin of error.
  • Multi-hop questions favour Google. On 824 FRAMES questions, the two Google SERP APIs scored 80.2% and 77.4%, and the independent indexes 48.4% to 65.3%.
  • The AI Overview does most of the work. On 100 questions, accuracy was 99% with it in the context and 89% without it.
  • Google results are short. About 800 tokens per question, against about 3,000 from Exa, Tavily, Brave and Parallel, which return page extracts.

The cost is latency: about 8 s p50 for the two Google SERP APIs (7.96 s and 8.20 s), against 0.74 s for Exa. If your pipeline must answer in less than 3 seconds, Exa or Tavily is the better choice today. Tavily returns page text ready for a prompt, and AI engines name it most often for this question.

Price: on cloro's Hobby plan ($100 a month for 250,000 credits), a Google search with the AI Overview is 5 credits through the async API, which is $2.00 per 1,000 searches. A synchronous call adds 2 credits, which is $2.80 per 1,000. The free plan has 500 credits a month.

Which one should you pick?

Your pipeline needs Use
Retrieval over your own documents or sites Agent Search, or Gemini File Search for files in a Gemini app
A Gemini app that shows grounded answers to users Grounding with Google Search
Google's web results as data, for any model, with caching and reranking A Google SERP API
Fast retrieval of page text, where Google's ranking does not matter Tavily or Exa
An existing Custom Search integration A migration before January 1, 2027

You can also combine them: Agent Search for internal documents, a SERP API for the web, and the Ranking API over both lists.

How this was checked

This comparison is published by cloro, which sells one of the SERP APIs in it. The Google names, response shapes, terms and prices come from the Google pages linked above, read on November 14, 2026. The accuracy, token and latency figures come from cloro's public benchmark of six web search APIs. The SERP API price range is for 250,000 searches a month. The full guide, with search-first code in Python and a TypeScript agent, is How to Add Web Search to an AI Agent or RAG Pipeline.

Top comments (0)