Providers
Brave
The Brave Search API, one GET per page, with extra snippets joined into text and a continuation that carries the offset.
- env var
- BRAVE_API_KEY
- auth
- X-Subscription-Token header
- operations
- search
- results
- 10, up to 20
Address it
import { create } from "@agntn/web";
const brave = create("brave"); // BRAVE_API_KEY
const results = await brave.search("typescript runtimes", { maxResults: 10 });
The key goes in the X-Subscription-Token header. Pass apiKey to create() if you do not want env involved.
What it reads
| Call | Endpoint |
|---|---|
search | GET /res/v1/web/search?q=…&count=…&offset=… on api.search.brave.com |
count is maxResults, 20 at most. offset comes from the continuation and steps through pages of that size. query.more_results_available in the response decides whether the next token is next or end, so Brave is one of the few engines that actually tells you.
What comes back
favicon from meta_url.favicon, and text as the extra_snippets joined with newlines when Brave sends them. No score, no date, and no filters at all. includeDomains and friends come back in ignoredFilters.
Gotchas
- A page is 20 results max. Ask for more and you get 20 plus a continuation.
- Snippets carry
<strong>markup and HTML entities exactly as Brave sends them. Data, render as text. - The free plan is a couple of thousand queries a month and a burst gets you a 429 with
Retry-After, which isRateLimitErrorhere.
Where it lives
src/providers/brave.ts. Smallest search adapter with pagination, copy it when you write a new one.