Skip to content

New AI assistant answers: ChatGPT, Gemini, Copilot and AI Mode by API

SerpKite
Get API key

LangChain GoogleSearchAPIWrapper ends January 1: the fix

GoogleSearchAPIWrapper calls the Custom Search JSON API, which shuts down January 1, 2027. A one-line patch and a clean replacement, both tested.

SerpKite team 2 min read

On this page

langchain_google_community’s GoogleSearchAPIWrapper builds a Google API client with build("customsearch", "v1", developerKey=GOOGLE_API_KEY) and calls the Custom Search JSON API. So do the GoogleSearchRun (google_search) and GoogleSearchResults (google_search_results_json) tools built on it. That API is closed to new projects, which get a 403 “does not have the access” error, and it shuts down for everyone on January 1, 2027.

If your agent reads GOOGLE_API_KEY and GOOGLE_CSE_ID, it is affected. Here are two fixes. We ran both against the live API on November 5, 2026.

Option 1: keep the wrapper, change where it sends requests

The wrapper’s validator always builds its own client, but search_engine can be replaced after construction. Point it at SerpKite’s /customsearch/v1, which takes the same parameters and returns the same items[]:

import os
from googleapiclient.discovery import build
from langchain_google_community import GoogleSearchAPIWrapper, GoogleSearchResults

key = os.environ["SERPKITE_API_KEY"]
search = GoogleSearchAPIWrapper(google_api_key=key, google_cse_id="any", k=5)
search.search_engine = build(
    "customsearch",
    "v1",
    developerKey=key,
    client_options={"api_endpoint": "https://api.serpkite.com/"},
)

search.results("python asyncio taskgroup", 5)  # [{"title", "link", "snippet"}, ...]
tool = GoogleSearchResults(api_wrapper=search)   # agents see the same tool as before

run(), results() and both tools work unchanged. cx is ignored, so any value passes validation. If your engine was limited to your own sites, pass search_params={"siteSearch": "docs.example.com"} to results().

One remaining dependency on Google

build() still downloads the Custom Search discovery document from Google. That works today, but if Google removes the document with the API, this patch breaks too. Treat it as a bridge and plan Option 2.

Option 2: switch to langchain-serpkite

langchain-serpkite is a LangChain partner package with tools that call SerpKite directly, with no Google client involved:

pip install -U langchain-serpkite
export SERPKITE_API_KEY=skt_live_...
langchain_google_community −5 lines
from langchain_google_community import (
  GoogleSearchAPIWrapper, GoogleSearchResults, GoogleSearchRun,
)

wrapper = GoogleSearchAPIWrapper(k=5)
results_tool = GoogleSearchResults(api_wrapper=wrapper)
text_tool = GoogleSearchRun(api_wrapper=wrapper)
langchain_serpkite +4 lines
from langchain_serpkite import (
  SerpKiteSearchResults, SerpKiteSearch,
)

results_tool = SerpKiteSearchResults(max_results=5)
text_tool = SerpKiteSearch(num=10)
  • SerpKiteSearchResults returns a list of dicts with title, link and snippet, as GoogleSearchResults did, plus position and domain.
  • SerpKiteSearch returns the results page as Markdown, with the answer box, People Also Ask and related searches when Google shows them. That gives the model more to work with than GoogleSearchRun’s joined snippets, in fewer tokens than JSON.
  • The model can set num, country, language and time (hour to year). Set endpoint="news", "scholar" or "maps" for other verticals.

The package also has SerpKiteAnswer (a cited answer), SerpKiteRetriever (results as Documents, optionally with full page Markdown) and SerpKiteWebpageLoader. Every class supports invoke and ainvoke.

Cost

A search is 1 credit on either route. New accounts get 2,500 free credits plus 1,000 a month, with no card; see pricing.

Written by the SerpKite team. Questions or corrections: support@serpkite.com. Subscribe via RSS.

Related posts

Start building

Get your API key in 30 seconds

2,500 free credits, then 1,000 every month. No credit card.