Brave LLM Context API delivers pre-extracted, relevance-ranked web content optimized for grounding LLM responses in real-time search results. Unlike traditional web search APIs that return links and snippets, LLM Context extracts the actual page content—text chunks, tables, code blocks, and structured data—so your LLM or AI agent can reason over it directly.
LLM Context vs AI Grounding
Feature
LLM Context (this)
AI Grounding (
answers
)
Output
Raw extracted content for YOUR LLM
End-to-end AI answers with citations
Interface
REST API (GET/POST)
OpenAI-compatible
/chat/completions
Searches
Single search per request
Multi-search (iterative research)
Speed
Fast (<1s)
Slower
Plan
Search
Answers
Endpoint
/res/v1/llm/context
/res/v1/chat/completions
Best for
AI agents, RAG pipelines, tool calls
Chat interfaces, research mode
Endpoint
GET https://api.search.brave.com/res/v1/llm/context
POST https://api.search.brave.com/res/v1/llm/context
Goggle URL or inline definition for custom re-ranking
Context Size Guidelines
Task Type
count
max_tokens
Example
Simple factual
5
2048
"What year was Python created?"
Standard queries
20
8192
"Best practices for React hooks"
Complex research
50
16384
"Compare AI frameworks for production"
Larger context windows provide more information but increase latency and cost (of your inference). Start with defaults and adjust.
Threshold Modes
Mode
Behavior
strict
Higher threshold — fewer but more relevant results
balanced
Default — good balance between coverage and relevance
lenient
Lower threshold — more results, may include less relevant content
Local Recall
The
enable_local
parameter controls location-aware recall:
Value
Behavior
null
(not set)
Auto-detect
— local recall enabled when any location header is provided
true
Force local
— always use local recall, even without location headers
false
Force standard
— always use standard web ranking, even with location headers
For most use cases, omit
enable_local
and let the API auto-detect from location headers.
Location Headers
Header
Type
Description
X-Loc-Lat
float
Latitude (-90.0 to 90.0)
X-Loc-Long
float
Longitude (-180.0 to 180.0)
X-Loc-City
string
City name
X-Loc-State
string
State/region code (ISO 3166-2)
X-Loc-State-Name
string
State/region name
X-Loc-Country
string
2-letter country code
X-Loc-Postal-Code
string
Postal code
Priority
:
X-Loc-Lat
+
X-Loc-Long
take precedence. When provided, text-based headers (City, State, Country, Postal-Code) are not used for location resolution. Provide text-based headers