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": []
}
}
}