answers by brave/brave-search-skills
npx skills add https://github.com/brave/brave-search-skills --skill answers需要 API 密钥 : 在 https://api.search.brave.com 获取
套餐 : 包含在 Answers 套餐中。请参阅 https://api-dashboard.search.brave.com/app/subscriptions/subscribe
| 使用场景 | 技能 | 原因 |
|---|---|---|
| 快速获取事实性答案(原始上下文) | llm-context | 单次搜索,为您的 LLM 返回原始上下文 |
| 获取带引用的快速 AI 答案 | answers (单次搜索模式) | 流式传输,带引用 |
| 进行深入的多搜索深度研究 | answers (研究模式) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 迭代式深度研究,综合带引用的答案 |
此端点 (/res/v1/chat/completions) 支持两种模式:
enable_citations。enable_research=true):多轮迭代深度研究,带有进度事件和综合带引用的答案。curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "How does the James Webb Space Telescope work?"}],
"model": "brave",
"stream": false
}'
curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "What are recent breakthroughs in fusion energy?"}],
"model": "brave",
"stream": true,
"enable_citations": true
}'
curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "Compare quantum computing approaches"}],
"model": "brave",
"stream": true,
"enable_research": true,
"research_maximum_number_of_iterations": 3,
"research_maximum_number_of_seconds": 120
}'
POST https://api.search.brave.com/res/v1/chat/completions
认证 : X-Subscription-Token: <API_KEY> 请求头 (或 Authorization: Bearer <API_KEY>)
SDK 兼容 : 通过 base_url="https://api.search.brave.com/res/v1" 可与 OpenAI SDK 配合使用
| 特性 | 单次搜索 (默认) | 研究 (enable_research=true) |
|---|---|---|
| 速度 | 快 | 慢 |
| 搜索次数 | 1 | 多次 (迭代) |
| 流式传输 | 可选 (stream=true/false) | 必需 (stream=true) |
| 引用 | enable_citations=true (仅限流式传输) | 内置 (在 <answer> 标签中) |
| 进度事件 | 否 | 是 (<progress> 标签) |
| 阻塞式响应 | 是 (stream=false) | 否 |
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|---|---|---|---|---|
messages | array | 是 | - | 单条用户消息 (必须恰好 1 条消息) |
model | string | 是 | - | 使用 "brave" |
stream | bool | 否 | true | 启用 SSE 流式传输 |
country | string | 否 | "US" | 搜索国家 (2 字母国家代码或 ALL) |
language | string | 否 | "en" | 响应语言 |
safesearch | string | 否 | "moderate" | 搜索安全级别 (off, moderate, strict) |
max_completion_tokens | int | 否 | null | 完成令牌数的上限 |
enable_citations | bool | 否 | false | 包含内联引用标签 (仅限单次搜索流式传输) |
web_search_options | object | 否 | null | OpenAI 兼容;search_context_size: low, medium, high |
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|---|---|---|---|---|
enable_research | bool | 否 | false | 启用研究模式 |
research_allow_thinking | bool | 否 | true | 启用扩展思考 |
research_maximum_number_of_tokens_per_query | int | 否 | 8192 | 每个查询的最大令牌数 (1024-16384) |
research_maximum_number_of_queries | int | 否 | 20 | 最大总搜索查询数 (1-50) |
research_maximum_number_of_iterations | int | 否 | 4 | 最大研究迭代次数 (1-5) |
research_maximum_number_of_seconds | int | 否 | 180 | 时间预算,单位秒 (1-300) |
research_maximum_number_of_results_per_query | int | 否 | 60 | 每个搜索查询的结果数 (1-60) |
| 约束 | 错误 |
|---|---|
enable_research=true 要求 stream=true | "阻塞响应不支持 'enable_research' 选项" |
enable_research=true 与 enable_citations=true 不兼容 | "研究模式不支持 'enable_citations' 选项" |
enable_citations=true 要求 stream=true | "阻塞响应不支持 'enable_citations' 选项" |
from openai import OpenAI
client = OpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
response = client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "How does the James Webb Space Telescope work?"}],
stream=False,
)
print(response.choices[0].message.content)
from openai import OpenAI
client = OpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
stream = client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "What are the current trends in renewable energy?"}],
stream=True,
extra_body={"enable_citations": True}
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
from openai import AsyncOpenAI
client = AsyncOpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
stream = await client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "Compare quantum computing approaches"}],
stream=True,
extra_body={
"enable_research": True,
"research_maximum_number_of_iterations": 3,
"research_maximum_number_of_seconds": 120
}
)
async for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
stream=false, 仅限单次搜索)标准 OpenAI 兼容 JSON:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"choices": [{"message": {"role": "assistant", "content": "The James Webb Space Telescope works by..."}, "index": 0, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 10, "completion_tokens": 50, "total_tokens": 60}
}
SSE 响应,包含 OpenAI 兼容的数据块:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Based on"},"index":0}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":" recent research"},"index":0}]}
data: [DONE]
enable_citations=true)| 标签 | 用途 |
|---|---|
<citation> | 内联引用参考 |
<usage> | JSON 成本/计费数据 |
| 标签 | 用途 | 保留? |
|---|---|---|
<queries> | 生成的搜索查询 | 调试 |
<analyzing> | URL 计数 (详细) | 调试 |
<thinking> | URL 选择推理 | 调试 |
<progress> | 统计信息:时间、迭代次数、查询数、分析的 URL 数、令牌数 | 监控 |
<blindspots> | 识别的知识盲点 | 是 |
<answer> | 最终综合答案 (仅发出最终答案;中间草稿被丢弃) | 是 |
<usage> | JSON 成本/计费数据 (包含在流式响应末尾) | 是 |
<usage> 标签包含 JSON 字符串化的成本和令牌数据:
<usage>{"X-Request-Requests":1,"X-Request-Queries":8,"X-Request-Tokens-In":15000,"X-Request-Tokens-Out":2000,"X-Request-Requests-Cost":0.005,"X-Request-Queries-Cost":0.032,"X-Request-Tokens-In-Cost":0.075,"X-Request-Tokens-Out-Cost":0.01,"X-Request-Total-Cost":0.122}</usage>
base_url="https://api.search.brave.com/res/v1"。enable_research=true)。base_url 和 api_key。支持同步和异步客户端。enable_citations=true 以获取内联引用标签,或使用研究模式,其答案会自动包含引用。messages 数组必须恰好包含 1 条用户消息。<usage> 标签以跟踪成本。每周安装量
33
代码仓库
GitHub 星标数
71
首次出现
2026 年 2 月 13 日
安全审计
安装于
gemini-cli32
codex32
opencode31
github-copilot31
kimi-cli31
amp30
Requires API Key : Get one at https://api.search.brave.com
Plan : Included in the Answers plan. See https://api-dashboard.search.brave.com/app/subscriptions/subscribe
| Use Case | Skill | Why |
|---|---|---|
| Quick factual answer (raw context) | llm-context | Single search, returns raw context for YOUR LLM |
| Fast AI answer with citations | answers (single-search) | streaming, citations |
| Thorough multi-search deep research | answers (research mode) | Iterative deep research, synthesized cited answer |
This endpoint (/res/v1/chat/completions) supports two modes:
enable_citations.enable_research=true): Multi-iteration deep research with progress events and synthesized cited answer.curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "How does the James Webb Space Telescope work?"}],
"model": "brave",
"stream": false
}'
curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "What are recent breakthroughs in fusion energy?"}],
"model": "brave",
"stream": true,
"enable_citations": true
}'
curl -X POST "https://api.search.brave.com/res/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
-d '{
"messages": [{"role": "user", "content": "Compare quantum computing approaches"}],
"model": "brave",
"stream": true,
"enable_research": true,
"research_maximum_number_of_iterations": 3,
"research_maximum_number_of_seconds": 120
}'
POST https://api.search.brave.com/res/v1/chat/completions
Authentication : X-Subscription-Token: <API_KEY> header (or Authorization: Bearer <API_KEY>)
SDK Compatible : Works with OpenAI SDK via base_url="https://api.search.brave.com/res/v1"
| Feature | Single-Search (default) | Research (enable_research=true) |
|---|---|---|
| Speed | Fast | Slow |
| Searches | 1 | Multiple (iterative) |
| Streaming | Optional (stream=true/false) | Required (stream=true) |
| Citations | enable_citations=true (streaming only) | Built-in (in <answer> tag) |
| Progress events |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
messages | array | Yes | - | Single user message (exactly 1 message) |
model | string | Yes | - | Use "brave" |
stream | bool | No | true | Enable SSE streaming |
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
enable_research | bool | No | false | Enable research mode |
research_allow_thinking | bool | No | true | Enable extended thinking |
research_maximum_number_of_tokens_per_query | int |
| Constraint | Error |
|---|---|
enable_research=true requires stream=true | "Blocking response doesn't support 'enable_research' option" |
enable_research=true incompatible with enable_citations=true | "Research mode doesn't support 'enable_citations' option" |
enable_citations=true requires stream=true | "Blocking response doesn't support 'enable_citations' option" |
from openai import OpenAI
client = OpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
response = client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "How does the James Webb Space Telescope work?"}],
stream=False,
)
print(response.choices[0].message.content)
from openai import OpenAI
client = OpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
stream = client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "What are the current trends in renewable energy?"}],
stream=True,
extra_body={"enable_citations": True}
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
from openai import AsyncOpenAI
client = AsyncOpenAI(
base_url="https://api.search.brave.com/res/v1",
api_key="your-brave-api-key",
)
stream = await client.chat.completions.create(
model="brave",
messages=[{"role": "user", "content": "Compare quantum computing approaches"}],
stream=True,
extra_body={
"enable_research": True,
"research_maximum_number_of_iterations": 3,
"research_maximum_number_of_seconds": 120
}
)
async for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
stream=false, single-search only)Standard OpenAI-compatible JSON:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"choices": [{"message": {"role": "assistant", "content": "The James Webb Space Telescope works by..."}, "index": 0, "finish_reason": "stop"}],
"usage": {"prompt_tokens": 10, "completion_tokens": 50, "total_tokens": 60}
}
SSE response with OpenAI-compatible chunks:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Based on"},"index":0}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"delta":{"content":" recent research"},"index":0}]}
data: [DONE]
enable_citations=true)| Tag | Purpose |
|---|---|
<citation> | Inline citation references |
<usage> | JSON cost/billing data |
| Tag | Purpose | Keep? |
|---|---|---|
<queries> | Generated search queries | Debug |
<analyzing> | URL counts (verbose) | Debug |
<thinking> | URL selection reasoning | Debug |
<progress> | Stats: time, iterations, queries, URLs analyzed, tokens | Monitor |
<blindspots> | Knowledge gaps identified |
The <usage> tag contains JSON-stringified cost and token data:
<usage>{"X-Request-Requests":1,"X-Request-Queries":8,"X-Request-Tokens-In":15000,"X-Request-Tokens-Out":2000,"X-Request-Requests-Cost":0.005,"X-Request-Queries-Cost":0.032,"X-Request-Tokens-In-Cost":0.075,"X-Request-Tokens-Out-Cost":0.01,"X-Request-Total-Cost":0.122}</usage>
base_url="https://api.search.brave.com/res/v1".enable_research=true) for complex questions needing multi-source synthesis (e.g., "Compare approaches to nuclear fusion").base_url and api_key. Works with both sync and async clients.enable_citations=true in single-search mode for inline citation tags, or use research mode which automatically includes citations in its answer.messages array must contain exactly 1 user message<usage> tag from streaming responses to track costsWeekly Installs
33
Repository
GitHub Stars
71
First Seen
Feb 13, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
gemini-cli32
codex32
opencode31
github-copilot31
kimi-cli31
amp30
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
52,100 周安装
| No |
Yes (<progress> tags) |
| Blocking response | Yes (stream=false) | No |
country | string | No | "US" | Search country (2-letter country code or ALL) |
language | string | No | "en" | Response language |
safesearch | string | No | "moderate" | Search safety level (off, moderate, strict) |
max_completion_tokens | int | No | null | Upper bound on completion tokens |
enable_citations | bool | No | false | Include inline citation tags (single-search streaming only) |
web_search_options | object | No | null | OpenAI-compatible; search_context_size: low, medium, high |
| No |
8192 |
| Max tokens per query (1024-16384) |
research_maximum_number_of_queries | int | No | 20 | Max total search queries (1-50) |
research_maximum_number_of_iterations | int | No | 4 | Max research iterations (1-5) |
research_maximum_number_of_seconds | int | No | 180 | Time budget in seconds (1-300) |
research_maximum_number_of_results_per_query | int | No | 60 | Results per search query (1-60) |
| Yes |
<answer> | Final synthesized answer (only the final answer is emitted; intermediate drafts are dropped) | Yes |
<usage> | JSON cost/billing data (included at end of streaming response) | Yes |