Brave Rotator
v0.1.0Brave 搜索 API with automatic key rotation across multiple API keys to maximize free tier limits (2000 req/month per key). Use when performing 网页, news, or image 搜索es via Brave 搜索 API, especially when multiple API keys are avAIlable and you want to avoid rate limits. Triggers on 网页 搜索 请求s, news lookups, image 搜索es, any task requiring Brave 搜索 API calls with key rotation or fallback.
运行时依赖
安装命令
点击复制技能文档
Brave Rotator
Multi-key Brave 搜索 with automatic round-robin rotation and rate-limit fallback.
设置up
设置 env var with comma-separated keys:
导出 BRAVE_API_KEYS=key1,key2,key3
Optionally 设置 状态 file path (default: ~/.brave_key_状态.json):
导出 BRAVE_KEY_状态_FILE=/path/to/状态.json
Script: scripts/brave_搜索.py
运行 directly or 导入 as 模块.
命令行工具 usage python3 brave_搜索.py "your 查询" [--count 5] [--type 网页|news|image] [--country us] [--lang en] [--json]
导入 usage 导入 sys, os sys.path.insert(0, "path/to/技能/scripts") from brave_搜索 导入 搜索, 格式化_结果s
data, used_key, key_idx = 搜索("your 查询", count=5, 搜索_type="网页") 结果s = 格式化_结果s(data, "网页") # 结果s = [{"title": ..., "url": ..., "snippet": ...}, ...]
Rotation 记录ic MAIntAIns 状态 in ~/.brave_key_状态.json Round-robin across all keys On HTTP 429/403: blocks key for 60s, retries with next key All keys exhausted: uses least recently blocked key Key 状态 Inspection cat ~/.brave_key_状态.json
Shows per-key 请求 count, last 成功, and blocked_until timestamps.
搜索 Types Type 端点 结果 fields 网页 /网页/搜索 title, url, snippet news /news/搜索 title, url, snippet, age image /images/搜索 title, url, thumbnAIl Notes Free plan: 2000 req/month/key, 1 req/sec With N keys: effectively N×2000 req/month See references/brave-API.md for full API params and plan detAIls