Skip to article

Brave

Web results with descriptions and extra snippets; native LLM Context and answer APIs have separate contracts.

On this page

Normalized search

Normalized search reads web.results, maps descriptions to snippets, and retains extra snippets as highlights. A valid query echo without a web section is accepted as empty web results. Unreported usage is null.

brave-search.ts · server
import { createSearch } from '@belweave/search-sdk';
import { brave } from '@belweave/search-sdk/brave';

const apiKey = process.env.BRAVE_API_KEY;
if (!apiKey) throw new Error('BRAVE_API_KEY is required');

const client = createSearch({ provider: brave({ apiKey }) });
const response = await client.web.search({
  query: 'SQLite write concurrency',
  limit: 5,
});
console.log(response.results, response.attempts);

The normalized adapter does not support domain-filter options. Adding it to a filtered fallback chain fails preflight. Native rich results, local information, images, news, and LLM Context must keep their original shapes.

Domain filters unavailable on the normalized adapter.

Provider-native client

brave-native.ts · server
import { createBraveClient } from '@belweave/search-sdk/native-brave';

const apiKey = process.env.BRAVE_API_KEY;
if (!apiKey) throw new Error('BRAVE_API_KEY is required');

const client = createBraveClient({ apiKey, timeoutMs: 10_000 });
const response = await client.search({ query: { q: 'SQLite write concurrency', count: 5 } });
console.log(response.data, response.metadata);

Read provider data from response.data and sanitized transport details from response.metadata. Native TypeScript response types are not runtime schema validation. Preserve the operation's native response and source identities.

Native operation inventory

Methods available on this native client. Paths are relative to each operation's fixed base; a provider may use more than one origin. Eligible operations retry only when you opt into a client retry policy.

17 / 17
MethodHTTP / relative pathResponse / retry eligibility
llmContextGET /v1/llm/contextjson · eligible
llmContextPostPOST /v1/llm/contextjson · no automatic retry
answersPOST /v1/chat/completionsjson · no automatic retry
answersStreamPOST /v1/chat/completionsSSE stream · no automatic retry
searchGET /v1/web/searchjson · eligible
searchPostPOST /v1/web/searchjson · no automatic retry
localPoisGET /v1/local/poisjson · eligible
poiDescriptionsGET /v1/local/descriptionsjson · eligible
richGET /v1/web/richjson · eligible
newsGET /v1/news/searchjson · eligible
newsPostPOST /v1/news/searchjson · no automatic retry
videosGET /v1/videos/searchjson · eligible
videosPostPOST /v1/videos/searchjson · no automatic retry
imagesGET /v1/images/searchjson · eligible
placesGET /v1/local/place_searchjson · eligible
suggestGET /v1/suggest/searchjson · eligible
spellcheckGET /v1/spellcheck/searchjson · eligible

Limits and operation lifecycle

  • Pass signal and per-call timeoutMs on native request input when needed.
  • Persist a returned job identifier before explicitly reading or polling the same job. Native clients do not automatically poll.
  • SSE data is incremental provider event text. Parse and validate terminal or error events according to the provider contract; there is no reconnect or replay.
  • Native operations may create, delete, ingest, or incur charges. A successful HTTP response is not proof that a remote job completed.

Official sources

Use the official reference for current schemas, account access, and operation-specific requirements.