Recipes

Search and Distill

One call: Google search → Distill top N results → structured Markdown + summaries

/search runs a Google query and pipes each top result through Distill in a single request. Use it when you want a research agent to land on the top-N pages without juggling a search API plus N Distill calls.

When to use it

  • Research agents — give the agent a single tool that does the searching and reading.
  • News / monitoring scanners — pull the latest five articles on a topic and summarize each.
  • RAG ingestion bursts — bootstrap a small knowledge base from a topical search in one shot.

If you already have URLs to read, stay on /distill (or /batch/distill) — /search adds cost per result.

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"])

Cost

  • 1 credit per result whose Distill stage succeeds.
  • +4 credits per LLM format per successful result (summary, question, highlights).
  • +1 base credit per search request (charged even when 0 results succeed).
  • Failed per-result Distills do not charge.

For the request above (5 results, summary requested) you pay 5 × (1 + 4) + 1 = 26 credits if every result succeeds.

Tips

  • Cap limit at the number you actually need. Each result costs at least 1 credit.
  • Use site to scope the search to one domain (e.g. site: "techcrunch.com") when you want curated sources.
  • Pair with {"type":"highlights","query":"…"} to get pull-quotes you can show in a digest.
  • For background jobs, leave the API's per-result timeout parameter at the default (30 s) — the slowest result drives total latency.