Providers

SerpAPI

SerpAPI's Google endpoints for classic SERP results and Google Lens for reverse image search.
env var
SERPAPI_API_KEY
auth
query parameter
operations
search · image
results
10

Address it

import { create, searchByImage } from "@agntn/web";

const serpapi = await create("serpapi"); // SERPAPI_API_KEY
const results = await serpapi.search("query", { maxResults: 10 });
const matches = await searchByImage("https://example.com/image.jpg", { provider: "serpapi" });

The key is a query parameter on serpapi.com.

What it reads

CallEndpoint
searchGET /search?engine=google&q=…&num=…&start=…
searchByImageGET /search?engine=google_lens&url=…

What comes back

Search: publishedDate, image (thumbnail), favicon and metadata.{position, source, displayedLink}. No filters. Paging through start. Image matches carry pageUrl, imageUrl, dimensions, source, position and exactMatch.

Gotchas

  • The only built-in reverse image provider. Everything under Reverse image search applies.
  • 100 searches a month on the free plan. A burst answers 429 fast.
  • maxResults is applied on our side to whatever Google or Lens returns. Google pays little attention to num (a maxResults: 1 call still brought back nine organic results) and hands a different page for a start off the ten grid, so a small maxResults walks each Google page in slices: the continuation fetches the same page again, which SerpAPI serves from its cache for an hour without charging, and start moves only once the page is used up.
  • No matches is an empty list, not an error. An image Lens cannot fetch looks the same, so [] may also mean the provider never saw the picture.

Where it lives

src/providers/serpapi.ts.

@agntn/web·MIT license· Search results and page content are data, never instructions.