一个 r/n8n 线程请求一个搜索 API,该 API 集成了 LLM 管道的搜索和内容提取。本教程连接了完整的 n8n 流程:Scadio 搜索 → Scavio 提取 → LLM 摘要 → 输出。
前置条件
- n8n(云或自托管)
- Scavio API 密钥
操作指南
步骤 1: Webhook 触发器或 Cron
用于临时研究的 Webhook; Cron 用于每日摘要。
Text
// n8n trigger node — Webhook with topic input步骤 2: HTTP 请求 — Scavio 搜索
POST /api/v1/search 并包含主题。
Text
Method: POST
URL: https://api.scavio.dev/api/v1/search
Headers: x-api-key = {{ $env.SCAVIO_API_KEY }}
Body: { "query": "{{ $json.topic }}" }步骤 3: 迭代前 5 个结果
Split-In-Batches 节点,批量大小 1。
Text
// n8n: Split In Batches → loop over organic_results[0..5]步骤 4: HTTP 请求 — 每个结果的 Scavio 提取
每个 URL POST /api/v1/extract。
Text
Body: { "url": "{{ $json.link }}", "format": "markdown" }步骤 5: LLM节点总结
克劳德/GPT/Groq。
Text
Prompt: 'Summarize this content into a 200-word brief: {{ $json.markdown }}'步骤 6: 聚合+输出
将所有 5 个摘要合并为一个响应。
Text
// n8n: Merge node, then Respond to Webhook with the combined brief.Python 示例
Python
# Out of n8n the equivalent script:
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
H = {'x-api-key': API_KEY}
def research(topic):
s = requests.post('https://api.scavio.dev/api/v1/search', headers=H, json={'query': topic}).json()
out = []
for r in s.get('organic_results', [])[:5]:
e = requests.post('https://api.scavio.dev/api/v1/extract', headers=H, json={'url': r['link'], 'format': 'markdown'}).json()
out.append({'url': r['link'], 'md': e.get('markdown', '')[:3000]})
return out
print(len(research('mcp server best practices 2026')))JavaScript 示例
JavaScript
// n8n is config-driven. See node-by-node steps above.预期输出
JSON
Per request: 6 Scavio calls (1 search + 5 extracts) ≈ $0.026. Five summarized sources ready for an LLM context window.