Skip to content

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

SerpKite
Get API key
Docs menu / Official SDKs

Official SDKs

Official SerpKite SDKs for TypeScript, Python (sync and async) and Go, plus LangChain, CrewAI and Vercel AI SDK packages: install, options, errors and batches.

View as Markdown

SerpKite ships official, typed clients for the three languages most agents are written in, and native packages for LangChain, CrewAI and the Vercel AI SDK. They are generated from the OpenAPI spec, so they track the v1 API exactly, and each one is open source in its own repository under github.com/serpkite.

Package Install Source
TypeScript / JavaScript npm install serpkite serpkite/serpkite-js
Python (sync + async) pip install serpkite serpkite/serpkite-python
Go go get github.com/serpkite/serpkite-go serpkite/serpkite-go
LangChain pip install langchain-serpkite serpkite/langchain-serpkite
CrewAI pip install "serpkite[crewai]" serpkite/serpkite-python (the serpkite.crewai module)
Vercel AI SDK (Next.js, Node, edge) npm install @serpkite/ai-sdk serpkite/serpkite-ai-sdk

Version 0.8.0 of the TypeScript, Python and Go SDKs adds the AI assistant methods (ChatGPT, Gemini, Copilot Search, Google AI Mode and Brave’s AI answer). In 0.8.1, TypeScript and Go stop retrying daily_limit_reached, as Python never did.

Every package reads the key from the SERPKITE_API_KEY environment variable by default, sends it as Authorization: Bearer, retries 429 (except daily_limit_reached) and 5xx responses with backoff, and returns the same results / meta envelope the HTTP API does.

export SERPKITE_API_KEY="skt_live_..."

TypeScript

Zero dependencies. Works on Node.js 18+, Bun, Deno and edge runtimes (Cloudflare Workers, Vercel Edge).

npm install serpkite
import { SerpKite } from "serpkite";

const sk = new SerpKite(); // reads SERPKITE_API_KEY
const res = await sk.search({ q: "best espresso machine", country: "us" });
console.log(res.results[0].title, res.meta.credits_used);

// Markdown for an LLM context window: returns a string
const md = await sk.search({ q: "best espresso machine", format: "markdown" });

Options: new SerpKite({ apiKey, baseUrl, timeoutMs, maxRetries }).

Every endpoint has a method: sk.search, sk.images, sk.videos, sk.news, sk.maps, sk.places, sk.place, sk.reviews, sk.shopping, sk.scholar, sk.patents, sk.autocomplete, sk.webpage, sk.extract, sk.map, sk.rank, sk.resolve (destinations of links returned with link_resolved: false) and sk.account; AI answers are sk.answer and sk.answerStream (an async iterator of results, delta and done events), research sk.research, sk.getResearch, sk.cancelResearch and sk.waitResearch; AI assistants are sk.chatgpt, sk.gemini, sk.copilot, sk.aiMode and sk.braveAi; crawls are sk.crawl, sk.getCrawl, sk.cancelCrawl and sk.waitForCrawl, monitors sk.monitors.create, list, get, update, delete, run, runs and iterRuns, and webhooks verifyWebhook and parseWebhook. Parameters use the API’s snake_case names (country, language, include_content, place_id…).

Batches and errors:

import { SerpKite, SerpKiteError } from "serpkite";

const sk = new SerpKite();
const { batches } = await sk.batches.create({
  endpoint: "search",
  requests: [{ q: "espresso grinder" }, { q: "burr grinder" }],
});
const done = await sk.batches.wait(batches[0].id); // polls until done or failed

try {
  await sk.search({ q: "" });
} catch (err) {
  if (err instanceof SerpKiteError) console.error(err.status, err.code, err.message, err.requestId);
}

Ask an AI assistant and check the answer for your brands:

const res = await sk.chatgpt({
  prompt: "What are the best CRMs for a 10-person startup?",
  track: ["hubspot.com", "Pipedrive"],
});
console.log(res.markdown);
for (const m of res.mentions ?? []) console.log(m.term, m.mentioned, m.cited);

Answers take 10–90 seconds, so the assistant methods wait at least 120 seconds per attempt, whatever timeout you set. They retry only on 429: an answer is billed once the assistant has written it, so a lost response is not asked again automatically (failed, refused and empty answers are free).

The API sends Access-Control-Allow-Origin: *, so the SDK also works in a browser. Don’t ship a production key to browsers; proxy through your backend or use a key with a low monthly limit.

Python

Built on httpx and pydantic v2, fully typed, Python 3.9+. SerpKite is synchronous; AsyncSerpKite has the same methods for asyncio.

pip install serpkite
from serpkite import SerpKite

sk = SerpKite()  # reads SERPKITE_API_KEY
res = sk.search("best espresso machine", country="us")
print(res.results[0].title, res.meta.credits_used)

md = sk.search("best espresso machine", format="markdown")  # str

Options: SerpKite(api_key=..., base_url=..., timeout=..., max_retries=...).

Methods: sk.search, sk.images, sk.videos, sk.news, sk.maps, sk.places, sk.place(place_id=...), sk.reviews(place_id=...), sk.shopping, sk.scholar, sk.patents, sk.autocomplete, sk.webpage(url), sk.extract(urls), sk.map(url), sk.rank(q, domain), sk.resolve(links) and sk.account(); AI answers are sk.answer(q) and sk.answer_stream(q), research sk.research(input), sk.get_research, sk.cancel_research and sk.wait_research; AI assistants are sk.chatgpt, sk.gemini, sk.copilot, sk.ai_mode and sk.brave_ai (pass prompt=); crawls are sk.crawl, sk.get_crawl, sk.cancel_crawl and sk.wait_for_crawl, monitors sk.monitors.create, list, get, update, delete, run, runs and iter_runs, and webhooks verify_webhook and parse_webhook.

Async, running several queries concurrently:

import asyncio
from serpkite import AsyncSerpKite

async def main() -> None:
    sk = AsyncSerpKite()
    queries = ["vector database", "rag evaluation", "mcp server"]
    pages = await asyncio.gather(*(sk.search(q, format="compact") for q in queries))
    for q, page in zip(queries, pages):
        print(q, page.results[0].link)

asyncio.run(main())

Batches and errors:

import serpkite
from serpkite import SerpKite

sk = SerpKite()
job = sk.batches.create(endpoint="search", requests=[{"q": "espresso grinder"}, {"q": "burr grinder"}])
done = sk.batches.wait(job.batches[0].id)

try:
    sk.search("")
except serpkite.SerpKiteError as err:
    print(err.status, err.code, err.message, err.request_id)

Go

Package serpkite, module github.com/serpkite/serpkite-go.

go get github.com/serpkite/serpkite-go
package main

import (
	"context"
	"fmt"
	"log"

	serpkite "github.com/serpkite/serpkite-go"
)

func main() {
	ctx := context.Background()
	c := serpkite.NewClient() // reads SERPKITE_API_KEY

	res, err := c.Search(ctx, serpkite.SearchParams{Q: "best espresso machine", Country: "us"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(res.Results[0].Title, res.Meta.CreditsUsed)

	md, err := c.SearchMarkdown(ctx, serpkite.SearchParams{Q: "best espresso machine"})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(md)
}

Options: serpkite.NewClient(serpkite.WithAPIKey(key), serpkite.WithBaseURL(url), serpkite.WithHTTPClient(hc), serpkite.WithMaxRetries(n)).

Methods: c.Search, c.Images, c.Videos, c.News, c.Maps, c.Places, c.Place, c.Reviews, c.Shopping, c.Scholar, c.Patents, c.Autocomplete, c.Webpage, c.Extract, c.Map, c.Rank, c.Resolve, c.Account, c.Batches.Create, c.Batches.Get and c.Batches.Wait; AI answers are c.Answer and c.AnswerStream, research c.Research, c.GetResearch, c.CancelResearch and c.WaitResearch; AI assistants are c.ChatGPT, c.Gemini, c.Copilot, c.AIMode and c.BraveAI; crawls are c.Crawl, c.GetCrawl, c.CancelCrawl and c.WaitForCrawl, monitors c.Monitors.Create, List, Get, Update, Delete, Run and Runs, and webhooks serpkite.VerifyWebhook.

Errors are returned as *serpkite.Error with Status, Code, Message and RequestID:

var apiErr *serpkite.Error
if errors.As(err, &apiErr) && apiErr.Code == "insufficient_credits" {
	// top up at https://app.serpkite.com/billing
}

LangChain

langchain-serpkite provides tools, a retriever and a document loader for LangChain and LangGraph.

pip install langchain-serpkite
from langchain_serpkite import (
    SerpKiteAPIWrapper,
    SerpKiteRetriever,
    SerpKiteSearch,
    SerpKiteSearchResults,
    SerpKiteWebpageLoader,
)

tool = SerpKiteSearch()              # returns Markdown, token-lean, for agents
results = SerpKiteSearchResults()    # returns a JSON list of results
retriever = SerpKiteRetriever(k=5, include_content=2)  # -> list[Document]
docs = SerpKiteWebpageLoader(["https://example.com"]).load()

Pass tool or results to any agent (create_react_agent, LangGraph tool nodes). SerpKiteRetriever returns the top results as Documents, with the page Markdown as content when include_content is set. More in the LangChain integration.

SerpKiteAnswer and SerpKiteResearch return cited answers and research reports. SerpKiteAssistant asks an AI assistant and returns its answer, sources, products and the mentions of the brands you track:

from langchain_serpkite import SerpKiteAssistant

chatgpt = SerpKiteAssistant(assistant="chatgpt", track=["hubspot.com", "Pipedrive"])  # serpkite_chatgpt
gemini = SerpKiteAssistant(assistant="gemini", country="de")  # also copilot, ai_mode, brave_ai

CrewAI

The CrewAI tool ships as an extra of the Python SDK.

pip install "serpkite[crewai]"
from crewai import Agent
from serpkite.crewai import SerpKiteSearchTool

tool = SerpKiteSearchTool()  # optional: endpoint="news", country="de", num=10
agent = Agent(
    role="Researcher",
    goal="Find current, sourced facts",
    backstory="You check the live web before answering.",
    tools=[tool],
)

SerpKiteAssistantTool(assistant="chatgpt", track=["acme.com"]) asks ChatGPT, Gemini (gemini), Copilot (copilot), Google AI Mode (ai_mode) or Brave AI (brave_ai) and returns the answer as Markdown with its sources and brand mentions.

More in the CrewAI integration.

Vercel AI SDK

@serpkite/ai-sdk turns every endpoint into a tool for the Vercel AI SDK (generateText, streamText and agents). It’s built on the TypeScript SDK, so retries, timeouts and SerpKiteError work the same way. Supports AI SDK 5, 6 and 7 with zod 3.25+ or 4.

npm install @serpkite/ai-sdk ai zod
import { openai } from "@ai-sdk/openai";
import { serpkiteTools } from "@serpkite/ai-sdk";
import { generateText, stepCountIs } from "ai";

const { text } = await generateText({
  model: openai("gpt-5-mini"),
  tools: serpkiteTools({ only: ["search", "webpage"] }),
  stopWhen: stepCountIs(5),
  prompt: "What changed in the latest Node.js LTS? Cite sources.",
});

serpkiteTools() returns 21 tools named like the MCP server’s: search, news, images, videos, maps, places, place, reviews, shopping, scholar, patents, autocomplete, webpage, extract, map, rank, crawl, crawl_result, answer, research and research_result. Pick them with only or exclude. The five AI assistant tools, chatgpt, gemini, copilot, ai_mode and brave_ai (factories serpkiteChatGPT, serpkiteGemini, serpkiteCopilot, serpkiteAIMode, serpkiteBraveAI), are added only when only names them, because an answer costs 2 to 5 credits and takes 10 to 90 seconds. Each tool’s input schema lists only the parameters its endpoint accepts, so the model can’t trigger a 400 for an unsupported field.

To name or configure one tool, use its factory (serpkiteSearch, serpkiteWebpage, serpkiteExtract…):

import { serpkiteSearch } from "@serpkite/ai-sdk";

const docsSearch = serpkiteSearch({
  description: "Search our documentation and changelog.", // what the model reads
  defaults: { country: "us" }, // the model may override these
  fixed: { include_domains: ["docs.example.com"], max_age: 3600 }, // the model can't
  format: "json", // markdown (default) | compact | json
});

Options: serpkiteTools({ only, exclude, format, wait, client, apiKey, baseUrl, timeoutMs, maxRetries }). With format: "markdown" (the default) the search, place and page tools return a string; compact and json return the typed responses. extract, map, rank, crawl, crawl_result, research and research_result always return JSON. crawl and research return a task id for crawl_result / research_result to poll; serpkiteCrawl({ wait: true }) waits for the pages instead.

The client is created on the first tool call, so a tool set defined at module scope doesn’t need SERPKITE_API_KEY at build time (next build). A thrown SerpKiteError reaches the model as a tool error and the run continues. A Next.js route handler with streamText and useChat is in the Next.js integration; more options are in the Vercel AI SDK integration.

MCP

For Claude, Cursor, VS Code and other MCP clients you don’t need an SDK at all: connect the remote MCP server at https://api.serpkite.com/v1/mcp with your key in an Authorization: Bearer header. See MCP server.

Other languages

Every language with an HTTP client can call SerpKite directly:

  1. POST https://api.serpkite.com/v1/<endpoint> with a JSON object body and Content-Type: application/json.
  2. Send the key as Authorization: Bearer skt_live_….
  3. On a non-2xx status, read error.code. Use bounded retries for read operations and 429. Extract, crawl creation and monitor creation/run can perform paid work even if the response is lost: avoid automatically retrying them on 5xx or timeouts. Batch creation can be retried safely with an Idempotency-Key.

To generate a typed client, feed the OpenAPI 3.1 spec to your generator of choice (openapi-generator, oapi-codegen, openapi-typescript…). See OpenAPI spec.

Other frameworks and automation tools have their own pages: LlamaIndex, Mastra, OpenAI Agents SDK, n8n and more under Integrations.

Site and scheduled workflows

Follow Site ingestion for map, extract and crawl examples, Scheduled monitoring for monitor management and run history, and RAG pipeline for search highlights and citation context. Extract/crawl formats select content within JSON; search Markdown responses are strings.

Last updated: 2026-10-28