实战范例

搜索并蒸馏

用 Thunderbit web scraping API 一次完成 Google 搜索与 Distill:返回 Markdown 以及 AI 摘要、Q&A、要点。

/search 在一次请求里跑 Google 搜索,并把每条排名靠前的结果交给 Distill 处理。当你希望一个研究型 agent 直接拿到 Top-N 页面的内容,而不必把搜索 API 和 N 次 Distill 调用拼在一起时,就用它。

什么时候用

  • 研究型 agent —— 给 agent 一个工具就同时搞定搜索和阅读。
  • 新闻 / 监控扫描器 —— 拉某个话题最新的五篇文章并各自总结。
  • RAG 入库爆发 —— 一把就基于话题搜索把小型知识库 bootstrap 起来。

如果你已经手上有 URL 要读,那就留在 /distill(或 /batch/distill)—— /search 每条结果会额外计费。

Quickstart

import httpx

API = "https://openapi.thunderbit.co/openapi/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}

resp = httpx.post(
    f"{API}/search",
    headers=H,
    json={
        "query":   "best web scraping tools 2026",
        "limit":   5,
        "formats": ["markdown", {"type": "summary"}],
    },
    timeout=120.0,
).json()

for r in resp["data"]["results"]:
    if r["success"]:
        print(r["position"], r["title"])
        print(r["summary"])
        print("---")

print("credits used:", resp["data"]["credits_used"])

费用

  • 每条 Distill 阶段成功的结果计 1 credit。
  • 每条成功结果上每个 LLM 格式额外计 +4 credits(summaryquestionhighlights)。
  • 每次搜索请求计 +1 基础 credit(即便 0 条结果成功也照收)。
  • 每条结果级别 Distill 失败的不计费。

对于上面的请求(5 条结果,要求 summary),如果每条结果都成功,你需要支付 5 × (1 + 4) + 1 = 26 credits。

小贴士

  • limit 设到你真正需要的条数即可。每条结果至少 1 credit。
  • 如果想要更精挑细选的来源,用 site 把搜索限定在某个域名上(例如 site: "techcrunch.com")。
  • 想拿到能放进 digest 的金句,搭配 {"type":"highlights","query":"…"} 使用。
  • 后台任务里把 API 端单条结果的 timeout 参数留在默认值(30 秒)就行——最慢的那条决定整体延迟。