API reference · Brave

brave/llm-context

Integrate this model through SandBase's unified API, with production-ready schemas and examples.

APISynchronousOpen model
Production endpoint

Send your first request

OpenAI-compatible endpoint with unified authentication and usage tracking.

POSThttps://api.sandbase.ai/v1/api/brave/llm-context
Model IDbrave/llm-context
01

Input Schema

16 parameters · 1 required · 15 optional

ParameterTypeRequiredDescription
qstringRequiredThe user’s search query term. Query can not be empty. Maximum of 600 characters and 75 words in the query.
countintegerOptionalThe maximum number of search results considered to select the LLM context data. The default is 20 and the maximum is 50. · Min: 1 · Max: 50 · Default: 20
countrystringOptionalThe search query country, where the results come from. The country string is limited to 2 character country codes of supported countries. · Options: AR, AU, AT, BE, BR, CA, CL, DK, FI, FR, DE, GR, HK, IN, ID, IT, JP, KR, MY, MX, NL, NZ, NO, CN, PL, PT, PH, RU, SA, ZA, ES, SE, CH, TW, TR, GB, US, ALL · Default: "US"
ARAUATBEBRCACLDKFIFRDEGRHKINIDITJPKRMYMXNLNZNOCNPLPTPHRUSAZAESSECHTWTRGBUSALL
gogglesstringOptionalGoggles act as a custom re-ranking on top of Brave’s search index. The parameter supports both a url where the Goggle is hosted or the definition of the Goggle. For more details, see the Goggles documentation . The parameter can be a single Goggle or a list of up to 3 Goggles.
freshnessstringOptionalFilters search results by page age. The age of a page is determined by the most relevant date reported by the content, such as its published or last modified date. The following values are supported: pd - Pages aged 24 hours or less. pw - Pages aged 7 days or less. pm - Pages aged 31 days or less. p · Default: ""
safesearchstringOptionalFilters results for adult content. The following values are supported: off - No filtering is done. moderate - Drops adult content from the results used for context. strict - Drops all adult content from the results used for context. When not set, no filtering is applied — except for local recall, wh · Options: off, moderate, strict
offmoderatestrict
spellcheckbooleanOptionalWhether to enable spellcheck on the query. · Default: true
search_langstringOptionalThe search language preference. The 2 or more character language code for which the search results are provided. · Options: ar, eu, bn, bg, ca, zh-hans, zh-hant, hr, cs, da, nl, en, en-gb, et, fi, fr, gl, de, el, gu, he, hi, hu, is, it, ja, jp, kn, ko, lv, lt, ms, ml, mr, nb, pl, pt-br, pt-pt, pa, ro, ru, sr, sk, sl, es, sv, ta, te, th, tr, uk, vi · Default: "en"
areubnbgcazh-hanszh-hanthrcsdanlenen-gbetfifrgldeelguhehihuisitjajpknkolvltmsmlmrnbplpt-brpt-ptparorusrskslessvtatethtrukvi
enable_localbooleanOptionalWhether to enable local recall. Not setting this value means auto-detect: local recall is used if a location is provided ( X-Loc-Lat with X-Loc-Long , or X-Loc-City ).
context_threshold_modestringOptionalThe mode to use to determine the threshold for including content in context. · Options: disabled, strict, lenient, balanced
disabledstrictlenientbalanced
enable_source_metadatabooleanOptionalEnable source metadata enrichment (site_name, favicon, thumbnail, description, fetched_content_timestamp) in the sources attribute of the response. · Default: false
maximum_number_of_urlsintegerOptionalMaximum number of different URLs to include in LLM context. · Min: 1 · Max: 50 · Default: 20
maximum_number_of_tokensintegerOptionalApproximate maximum number of tokens to include in context. The default is 8192 and maximum is 32768 . · Min: 1024 · Max: 32768 · Default: 8192
maximum_number_of_snippetsintegerOptionalMaximum number of different snippets (or chunks of text) to include in LLM context. The default is 50 and maximum is 256 . · Min: 1 · Max: 256 · Default: 50
maximum_number_of_tokens_per_urlintegerOptionalMaximum number of tokens to include per URL. The default is 4096 and maximum is 8192 . · Min: 512 · Max: 8192 · Default: 4096
maximum_number_of_snippets_per_urlintegerOptionalMaximum number of snippets to include per URL. The default is 50 and maximum is 100 . · Min: 1 · Max: 100 · Default: 50
02

Output Schema

FieldTypeDescription
idstringUnique identifier for the generation task
statusstringTask status: pending, running, completed, failed, timeout
modelstringModel used for the generation
outputsarrayArray of output items
outputs[].urlstringURL of the generated artifact
outputs[].content_typestringMIME type (e.g. image/png, video/mp4)
errorobject | nullError details if failed, null on success
error.typestringMachine-readable error type code
error.messagestringHuman-readable error description
03

Code Examples

Ready-to-run snippets

const apiKey = process.env.SANDBASE_API_KEY;
const response = await fetch("https://api.sandbase.ai/v1/api/brave/llm-context", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "count": 20,
    "country": "US",
    "freshness": "",
    "spellcheck": true,
    "search_lang": "en",
    "enable_source_metadata": false,
    "maximum_number_of_urls": 20,
    "maximum_number_of_tokens": 8192,
    "maximum_number_of_snippets": 50,
    "maximum_number_of_tokens_per_url": 4096,
    "maximum_number_of_snippets_per_url": 50
  }),
});

if (!response.ok) throw new Error(await response.text());
console.log(await response.json());