Providers
SerpBase
SerpBase's Google SERP endpoints, with a category that picks the web, images, news or videos endpoint.
- env var
- SERPBASE_API_KEY
- auth
- X-API-Key header
- operations
- search
- results
- 10, up to 20
Address it
import { create } from "@agntn/web";
const serpbase = create("serpbase"); // SERPBASE_API_KEY
const results = await serpbase.search("query", { category: "news", maxResults: 10 });
The key goes in the X-API-Key header against api.serpbase.dev.
What it reads
| Call | Endpoint |
|---|---|
search | POST to the endpoint the category picks: web by default, images/image, news, videos/video |
What comes back
publishedDate, image, favicon and metadata.{position, rank, searchType, requestId, elapsedMs, creditsCharged}. Only category is honoured. Paging works, but the next token stays unknown until a page comes back empty, SerpBase does not say when it is done.
Gotchas
maxResultsis applied on our side to the returned page, the endpoint decides the page size.- Credits are charged per request and reported in
metadata.creditsCharged. An empty balance answers with an error that is not eligible for fallback.
Where it lives
src/providers/serpbase.ts.