Service APIs
Overview
Answers returns AI-generated answers grounded in real-time Brave Search results, with verifiable citations. The same service powers Brave’s Ask Brave feature. At launch (August 2025), Brave reported state-of-the-art results on the SimpleQA benchmark.
Access to the API is available through the Answers plan. Activate the Answers plan to unlock these capabilities.
LLM Context vs Answers
Use LLM Context when your own model reasons over pre-extracted web content; use Answers when you want a finished, cited answer.
LLM Context
Raw extracted content for your own LLM pipeline. Best for AI agents, RAG, and applications where you control the model.
Answers
Finished, cited answers from an OpenAI-compatible endpoint. Best when you don’t run your own model.
When to use LLM Context:
- Giving your AI agent a web search tool it can call autonomously
- Building RAG pipelines with your own LLM
- Need full control over how context is processed and presented
- Want raw extracted content without AI-generated summaries
When to use Answers:
- Want end-to-end AI answers with citations
- Need OpenAI SDK compatibility
- Answering one question per request (Answers takes a single
usermessage, no history) - Require research mode for thorough, multi-search answers
Key Features
Web-Grounded Answers
AI responses backed by real-time web search with verifiable citations
OpenAI SDK Compatible
Use the familiar OpenAI SDK for seamless integration
Streaming Support
Stream answers in real-time with progressive citations
Research Mode
Enable multi-search for thorough, research-grade answers
Rich Response Data
Get citations and structured data with answers
API Reference
Answers API Documentation
View the complete API reference, including parameters and response schemas
Use Cases
Answers is perfect for:
- AI Assistants & Chatbots: Answer user questions with factual, cited responses
- Research Applications: Conduct thorough research with multi-search capabilities
- Question Answering Systems: Provide accurate answers with source attribution
- Knowledge Applications: Create tools that need up-to-date, verifiable information
- Content Generation: Generate well-researched content with citations
Endpoint
Answers uses a single, OpenAI-compatible endpoint:
POST https://api.search.brave.com/res/v1/chat/completionsAuthenticate with your API key in the x-subscription-token header, or as Authorization: Bearer <YOUR_BRAVE_SEARCH_API_KEY> (what the OpenAI SDK sends).
One question per request. messages must contain exactly one message with role user.
System prompts, assistant turns and conversation history are rejected with HTTP 422, so put
any context your question needs into that single message.
stream defaults to true, unlike OpenAI. Always pass stream explicitly: the OpenAI SDK
expects a single JSON response unless you set stream=True.
Quick Start
Basic Example with OpenAI SDK
from openai import OpenAI
client = OpenAI(
api_key="YOUR_BRAVE_SEARCH_API_KEY",
base_url="https://api.search.brave.com/res/v1",
)
completions = client.chat.completions.create(
messages=[
{
"role": "user",
"content": "What are the best things to do in Paris with kids?",
}
],
model="brave",
stream=False,
)
print(completions.choices[0].message.content)Streaming Example
For real-time responses, enable streaming with AsyncOpenAI:
from openai import AsyncOpenAI
import asyncio
client = AsyncOpenAI(
api_key="YOUR_BRAVE_SEARCH_API_KEY",
base_url="https://api.search.brave.com/res/v1",
)
async def stream_answer():
async for chunk in await client.chat.completions.create(
messages=[
{
"role": "user",
"content": "Explain quantum computing",
}
],
model="brave",
stream=True,
):
# Some chunks (such as usage) can arrive without choices
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
asyncio.run(stream_answer())Using cURL
While the OpenAI SDK is recommended, you can also use cURL:
curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "x-subscription-token: <YOUR_BRAVE_SEARCH_API_KEY>" \
-d '{"model": "brave", "stream": false, "messages": [{"role": "user", "content": "What is the second highest mountain?"}]}'Single vs Multiple Searches
The decision between single-search and multi-search significantly influences both cost efficiency and response time.
Single Search (Default)
- Speed: Answers typically stream in under 4.5 seconds on average
- Cost: Lower cost with minimal computational overhead
- Use Case: Ideal for real-time applications and most queries
- Performance: Median SimpleQA benchmark question answered with single search
Multiple Searches (Research Mode)
- Thoroughness: Model iteratively refines strategy with sequential searches
- Cost: Higher due to multiple API calls and larger context processing
- Time: Response times can extend to minutes
- Use Case: Best for background tasks prioritizing thoroughness over speed
Enable research mode by adding enable_research: true. Research mode requires stream: true and a plan that includes it; otherwise the request fails with HTTP 400 OPTION_NOT_IN_PLAN.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_BRAVE_SEARCH_API_KEY",
base_url="https://api.search.brave.com/res/v1",
)
stream = client.chat.completions.create(
messages=[{"role": "user", "content": "History of quantum mechanics"}],
model="brave",
stream=True,
extra_body={
"enable_research": True,
},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Performance note: On the SimpleQA benchmark, p99 questions required 53 queries analyzing 1000 pages over ~300 seconds. However, reasonable limits are in place based on real-world use cases.
Advanced Parameters
When using the OpenAI SDK, pass additional parameters via extra_body:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_BRAVE_SEARCH_API_KEY",
base_url="https://api.search.brave.com/res/v1",
)
stream = client.chat.completions.create(
messages=[{"role": "user", "content": "History of Rome"}],
model="brave",
stream=True,
extra_body={
"country": "IT",
"language": "it",
"enable_citations": True,
"enable_research": False,
},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)enable_citations, enable_entities and enable_research all require stream: true.
Citations and entities are not available in research mode. Any other combination returns
HTTP 422.
Available Parameters
- model (string):
braveorbrave-pro(default:brave-pro), accepted for OpenAI SDK compatibility; both currently return the same answer - stream (bool): Stream the answer as server-sent events (default:
true) - country (string): Target country for search results (default:
us) - language (string): Response language. If omitted, single-search answers follow the query’s language
- safesearch (string): Adult content filter,
off,moderateorstrict(default:moderate) - enable_citations (bool): Include inline
<citation>tags (default:false) - enable_entities (bool): Reserved for inline entity tags; validated but currently has no effect (default:
false) - enable_research (bool): Enable multi-search research mode (default:
false)
Research mode limits (only used with enable_research: true):
| Parameter | Default | Range |
|---|---|---|
research_maximum_number_of_queries | 20 | 1–50 |
research_maximum_number_of_iterations | 4 | 1–5 |
research_maximum_number_of_seconds | 180 | 1–300 |
research_maximum_number_of_tokens_per_query | 8192 | 1024–16384 |
research_maximum_number_of_results_per_query | 30 | 1–60 |
See the API reference for the full request schema.
Response Format
Because Answers returns richer data than standard OpenAI responses, extra messages are
stringified inside tags in delta.content. When streaming, you’ll receive:
Standard Text
Regular answer content streamed as text.
Citations
With enable_citations: true:
<citation>{"start_index": 0, "end_index": 10, "number": 1, "url": "https://...", "favicon": "...", "snippet": "..."}</citation>Usage
<usage>{"X-Request-Requests": 1, "X-Request-Queries": 2, ...}</usage>The JSON holds the fields described in Usage metadata.
Research Progress
In research mode, the stream also carries <progress> messages, each paired
with a <usage> message holding the running totals so far. Usage therefore repeats during the
stream: the last <usage> is the final total, so don’t add them up. Skip any tag you don’t
handle.
Complete Streaming Example
Here’s a full example that handles all message types:
#!/usr/bin/env python
import asyncio
import json
from openai import AsyncOpenAI
client = AsyncOpenAI(
api_key="YOUR_BRAVE_SEARCH_API_KEY",
base_url="https://api.search.brave.com/res/v1",
)
async def main():
async for data in await client.chat.completions.create(
messages=[
{
"role": "user",
"content": "albums from lady gaga",
}
],
model="brave",
stream=True,
extra_body={
"country": "us",
"language": "en",
"enable_citations": True,
"enable_research": False,
},
):
if choices := data.choices:
if delta := choices[0].delta.content:
if delta.startswith("<citation>") and delta.endswith("</citation>"):
citation = json.loads(
delta.removeprefix("<citation>").removesuffix("</citation>")
)
print(f"[{citation['number']}]({citation['url']})", end="", flush=True)
elif delta.startswith("<usage>") and delta.endswith("</usage>"):
usage = json.loads(
delta.removeprefix("<usage>").removesuffix("</usage>")
)
print("\n\nUsage:", usage)
elif not delta.startswith("<"):
# Plain answer text; other tags are skipped
print(delta, end="", flush=True)
if __name__ == "__main__":
asyncio.run(main())Pricing & Spending Limits
Answers uses a usage-based pricing model:
Cost Calculation:
cost = (searches × $4/1000) + (input_tokens × $5/1000000) + (output_tokens × $5/1000000)Example:
- 2 searches
- 1,234 input tokens
- 300 output tokens
Cost = 2 × (4/1000) + (5/1000000) × 1234 + (5/1000000) × 300
= $0.01567Usage Metadata
With each answer, you’ll receive metadata on resource usage:
{
"X-Request-Requests": 1,
"X-Request-Queries": 2,
"X-Request-Tokens-In": 1234,
"X-Request-Tokens-Out": 300,
"X-Request-Requests-Cost": 0,
"X-Request-Queries-Cost": 0.008,
"X-Request-Tokens-In-Cost": 0.00617,
"X-Request-Tokens-Out-Cost": 0.0015,
"X-Request-Total-Cost": 0.01567
}When streaming, this metadata arrives as a <usage> message near the end of the stream (repeated
with running totals in research mode). For non-streaming requests, the same keys are returned as
response headers.
Setting Limits
Control your spending by setting monthly credit limits in your account.
Limit behavior: Limits are checked before answering. If limits aren’t exceeded when a question starts, it will be answered in full even if it exceeds limits during processing. You’ll only be charged up to your imposed limit.
Rate Limits
- Default: 2 requests per second
- Exceeding it returns HTTP 429; see Rate limiting
- Need more? Contact searchapi-support@brave.com
Best Practices
Message Handling
- Always handle special message tags (
<citation>,<usage>, and<progress>in research mode) - Parse JSON content within tags to extract structured data
- Display citations inline for better user trust
Streaming
- Both
OpenAIandAsyncOpenAIclients can stream; passstreamexplicitly - Display content progressively for better UX
- Use the last
<usage>message as the request’s total
Research Mode
- Enable only when thoroughness is more important than speed
- Best for background processing or complex research queries
- Monitor usage as it can incur higher costs
Error Handling
- Implement retry logic for transient failures
- Check spending limits before critical operations
- Back off on HTTP 429 (rate limited); fix the request on HTTP 422 (invalid parameters)
Performance
- Use single-search mode (default) for most queries
- Cache responses when appropriate to minimize API calls
- Monitor usage metadata to optimize costs
Changelog
This changelog outlines all significant changes to the Answers API, newest first.
2026-08-21
research_maximum_number_of_results_per_querynow defaults to30instead of60. The accepted range is unchanged, so pass the value explicitly to keep the old breadth.
2025-08-05
- Launch Brave Answers API resource
- OpenAI SDK compatibility
- Support for single and multi-search modes