跳至主要內容

Brave 搜尋

先透過 https://brave.com/search/api/. 建立免費 API 金鑰開始使用

如需 Brave Search API 支援的其他參數文件,請造訪 https://api-dashboard.search.brave.com/api-reference/web/search/post.

LiteLLM Python SDK​

Brave Search
import os
from litellm import search

os.environ["BRAVE_API_KEY"] = "BSATzx..."

response = search(
query="Brave browser features",
search_provider="brave",
max_results=5
)

LiteLLM AI Gateway​

1. 設定 config.yaml​

config.yaml
model_list:
- model_name: gpt-5.6-terra
litellm_params:
model: gpt-5.6-terra
api_key: os.environ/OPENAI_API_KEY

search_tools:
- search_tool_name: brave-search
litellm_params:
search_provider: brave
api_key: os.environ/BRAVE_API_KEY

2. 啟動 proxy​

litellm --config /path/to/config.yaml

# RUNNING on http://0.0.0.0:4000

3. 測試搜尋端點​

Test Request
curl http://0.0.0.0:4000/v1/search/brave-search \
-H "Authorization: Bearer $LITELLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "query": "Brave browser features", "max_results": 5 }'
LiteLLM Enterprise
為正式環境打造的 SSO/SAML、稽核記錄、支出追蹤、多團隊管理與防護欄。
深入瞭解 →