Loading...
Loading...
USE FOR RAG/LLM grounding. Returns pre-extracted web content (text, tables, code) optimized for LLMs. GET + POST. Adjust max_tokens/count based on complexity. Supports Goggles, local/POI. For AI answers use answers. Recommended for anyone building AI/agentic applications.
npx skill4agent add brave/brave-search-skills llm-contextRequires API Key: Get one at https://api.search.brave.comPlan: Included in the Search plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe
| Feature | LLM Context (this) | AI Grounding ( |
|---|---|---|
| Output | Raw extracted content for YOUR LLM | End-to-end AI answers with citations |
| Interface | REST API (GET/POST) | OpenAI-compatible |
| Searches | Single search per request | Multi-search (iterative research) |
| Speed | Fast (<1s) | Slower |
| Plan | Search | Answers |
| Endpoint | | |
| Best for | AI agents, RAG pipelines, tool calls | Chat interfaces, research mode |
GET https://api.search.brave.com/res/v1/llm/context
POST https://api.search.brave.com/res/v1/llm/contextX-Subscription-Token: <API_KEY>Accept-Encoding: gzipcurl -s "https://api.search.brave.com/res/v1/llm/context?q=tallest+mountains+in+the+world" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"curl -s --compressed -X POST "https://api.search.brave.com/res/v1/llm/context" \
-H "Accept: application/json" \
-H "Accept-Encoding: gzip" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"q": "tallest mountains in the world"}'curl -s "https://api.search.brave.com/res/v1/llm/context" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-G \
--data-urlencode "q=rust programming" \
--data-urlencode 'goggles=$discard
$site=docs.rs
$site=rust-lang.org'| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Search query (1-400 chars, max 50 words) |
| string | No | | Search country (2-letter country code or |
| string | No | | Language preference (2+ char language code) |
| int | No | | Max search results to consider (1-50) |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| int | No | | Max URLs in response (1-50) |
| int | No | | Approximate max tokens in context (1024-32768) |
| int | No | | Max snippets across all URLs (1-100) |
| int | No | | Max tokens per individual URL (512-8192) |
| int | No | | Max snippets per individual URL (1-100) |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No | | Relevance threshold for including content ( |
| bool | No | | Local recall control ( |
| string/list | No | | Goggle URL or inline definition for custom re-ranking |
| 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" |
| Mode | Behavior |
|---|---|
| Higher threshold — fewer but more relevant results |
| Default — good balance between coverage and relevance |
| Lower threshold — more results, may include less relevant content |
enable_local| Value | Behavior |
|---|---|
| Auto-detect — local recall enabled when any location header is provided |
| Force local — always use local recall, even without location headers |
| Force standard — always use standard web ranking, even with location headers |
enable_local| Header | Type | Description |
|---|---|---|
| float | Latitude (-90.0 to 90.0) |
| float | Longitude (-180.0 to 180.0) |
| string | City name |
| string | State/region code (ISO 3166-2) |
| string | State/region name |
| string | 2-letter country code |
| string | Postal code |
Priority:+X-Loc-Lattake precedence. When provided, text-based headers (City, State, Country, Postal-Code) are not used for location resolution. Provide text-based headers only when you don't have coordinates.X-Loc-Long
curl -s "https://api.search.brave.com/res/v1/llm/context" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-H "X-Loc-Lat: 37.7749" \
-H "X-Loc-Long: -122.4194" \
-G \
--data-urlencode "q=best coffee shops near me"curl -s "https://api.search.brave.com/res/v1/llm/context" \
-H "Accept: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-H "X-Loc-City: San Francisco" \
-H "X-Loc-State: CA" \
-H "X-Loc-Country: US" \
-G \
--data-urlencode "q=best coffee shops near me"| Use Case | Goggle Rules |
|---|---|
| Official docs only | |
| Exclude user content | |
| Academic sources | |
| No paywalls | |
| Method | Example |
|---|---|
| Hosted | |
| Inline | |
Hosted goggles must be on GitHub/GitLab, include,! name:,! description:headers, and be registered at https://search.brave.com/goggles/create. Inline rules need no registration.! author:
$boost=N$downrank=N$discard$site=example.com$site=example.com,boost=3\n%0A$discard\n$site=docs.python.org\n$site=developer.mozilla.org$discard,site=pinterest.com\n$discard,site=quora.com{
"grounding": {
"generic": [
{
"url": "https://example.com/page",
"title": "Page Title",
"snippets": [
"Relevant text chunk extracted from the page...",
"Another relevant passage from the same page..."
]
}
],
"map": []
},
"sources": {
"https://example.com/page": {
"title": "Page Title",
"hostname": "example.com",
"age": ["Wednesday, January 15, 2025", "2025-01-15", "392 days ago"]
}
}
}enable_local{
"grounding": {
"generic": [...],
"poi": {
"name": "Business Name",
"url": "https://business.com",
"title": "Title of business.com website",
"snippets": ["Business details and information..."]
},
"map": [
{
"name": "Place Name",
"url": "https://place.com",
"title": "Title of place.com website",
"snippets": ["Place information and details..."]
}
]
},
"sources": {
"https://business.com": {
"title": "Business Name",
"hostname": "business.com",
"age": null
}
}
}| Field | Type | Description |
|---|---|---|
| object | Container for all grounding content by type |
| array | Array of URL objects with extracted content (main grounding data) |
| string | Source URL |
| string | Page title |
| array | Extracted smart chunks relevant to the query |
| object/null | Point of interest data (only with local recall) |
| string/null | Point of interest name |
| string/null | POI source URL |
| string/null | POI page title |
| array/null | POI text snippets |
| array | Map/place results (only with local recall) |
| string/null | Place name |
| string/null | Place source URL |
| string/null | Place page title |
| array/null | Place text snippets |
| object | Metadata for all referenced URLs, keyed by URL |
| string | Page title |
| string | Source hostname |
| array/null | Page modification dates (when available) |
maximum_number_of_tokens=8192count=20context_threshold_mode=strictcountmaximum_number_of_tokens