API Hop 文档
Brave 接口参考
Brave: AI Mode 回答.
并发上限
AI 与 Data 分别共享账户级并发槽位,默认 5 AI / 2 Data,订阅套餐可调整上限。接口单独配置仍受分类总上限约束。达到任一上限返回 HTTP 429;异步任务执行结束前占用槽位。
GET /v1/brave/ai-mode 默认并发上限: 2
Brave: AI Mode 回答.
认证与计费
默认每次成功请求 $0.0003(300 credits)。 使用 API Hop API Key。可用性取决于已启用网关和密钥权限。每次成功请求的价格以当前目录和账户显示为准,账户专属价格优先。成功的空结果也计费,失败请求释放预占额度。超时为 60 秒,不自动重试或翻页,结算失败不会重复调用上游。
http
Authorization: Bearer YOUR_API_KEY仅接受查询参数,不接受请求体。拒绝未知、重复、空值或无效参数。仅支持 JSON,不自动翻页或重试。标识和续查令牌应从最新响应复制,示例仅供说明。每次完成的查询分别计费,包括已确认的空结果或不可用结果。XOR 表示二选一,NOT 表示不能提供,=> 表示需要。
Brave: AI Mode 回答
GET https://api.apihop.ai/v1/brave/ai-mode
请求参数
| 字段 | 类型 | 约束 | 示例 |
|---|---|---|---|
query | string | 搜索词; query: REQUIRED; minLength: 1; UTF-8 bytes: 8192 | What is coffee? |
device | string | 设备; device: optional; desktop, mobile, tablet | desktop |
zero_trace | boolean | 不归档响应产物; zero_trace: optional | true |
country | string | 国家筛选 (country); country: optional; ar, au, at, be, br, ca, cl, cn, dk, fi, ... 38; ^[A-Za-z]{2}$ | ar |
language | string | 语言; language: optional; az, bg, br, ca, cs, cy, da, de, el, en, ... 43 | az |
coordinates | string | 坐标 JSON(latitude 和 longitude) (coordinates); coordinates: optional | {"latitude":30.2672,"longitude":-97.7431} |
safe | string | 结果筛选 (safe); safe: optional; off, moderate, strict | off |
units_of_measurement | string | 计量单位 (units_of_measurement); units_of_measurement: optional; metric, us | metric |
next_page_token | string | 从上次响应复制的续查令牌;保持原账户、查询、设备及筛选条件。有效期通常为一小时,过期后重新开始。; next_page_token: optional; minLength: 1; maxLength: 24576 | - |
location | string | 搜索起点; location: optional; maxLength: 512 | - |
校验规则
GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supportedboolean = true OR false; integer: safe integer; unknown, repeated, empty or invalid query values: rejectedcoordinates: JSON object {"latitude":number,"longitude":number}; latitude -90..90; longitude -180..180; NOT (location AND coordinates); NOT (uule AND location); NOT (uule AND coordinates)next_page_token: copy from a fresh response; keep original query, localization and filters; do not fabricate tokens
示例
bash
curl --get "https://api.apihop.ai/v1/brave/ai-mode" \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "query=What is coffee?"响应与错误
保留原生 JSON 响应和数字精度。下方仅为空成功结果示例,不是真实调用。HTTP 400 表示输入无效;401 需要认证;402 余额不足;403 不可用或无权限;405 方法不支持;429 限流;5xx 服务或上游故障。请保留 X-Request-Id 以便排查。
json
{
"success": true,
"request_id": "example-request",
"data": {
"format": "json",
"content": {
"results": []
}
}
}