Reference

API reference

Hub of modules. Machine-readable spec: /openapi.json. Base URL: https://distill.prometheus-potential.workers.dev. One Bearer key for Distill and Memory.

GET /health

Liveness. No auth. Returns ok, service: distill (Worker id), hub: prometheus-potential, and modules.

POST /v1/distill

Body: {"url?": "string", "query?": "string", "budget?": "fast"|"deep", "mode?": "fast"|"deep"}. Provide url or query. mode is an alias for budget. Query mode uses Brave/Bing if those secrets are set, else DuckDuckGo Instant Answer + Bing RSS + Wikipedia extracts (+ DuckDuckGo HTML if the others are empty). Returns facts, citations, cache metadata, model, and extraction mode (llm or heuristic fallback). deep costs 3 fast units. Unchanged Distill contract.

POST /v1/remember

Distill memory lite. Body: {"project_id","key","value","tags?"}. Value capped at 32 KB. Upserts by (key_id, project_id, key).

GET /v1/recall

Distill memory lite. Query: project_id (required), q (required). Substring match on key, value, and tags.

POST /v1/memory

Memory module write. Body: {"project_id","content","key?","ttl_seconds?","source_url?","tags?"}. Content max 32 KB. Optional key upserts in that project. Optional TTL (60s–1y). source_url is stored, never fetched. 1 write unit.

GET /v1/memory/:id

Read one Memory item. Expired rows 404 unless include_expired=1. 1 read unit.

GET /v1/memory

Search. Query: project_id (required), q (optional), include_expired (optional), limit (max 50). 1 read unit.

DELETE /v1/memory/:id

Hard-delete one Memory item owned by the calling key. 1 write unit.

GET /v1/usage

UTC-day counters and plan limits for Distill and Memory.

POST /v1/signup

No auth. Mints a free dk_live_ hub key (shown once). Rate-limited per IP. HTML form: /start.

POST /v1/keys

Admin only. Header Authorization: Bearer $ADMIN_TOKEN. Body: {"kind":"live"|"test","plan":"free"|"pro","label?"}. Raw secret is returned once.

POST /v1/billing/checkout

Authenticated. Creates a Stripe Checkout Session for the Pro hub pack when STRIPE_SECRET_KEY is configured; otherwise returns the Payment Link (DISTILL_PRO_PAYMENT_LINK) with client_reference_id set to your key id. HTML: POST /billing/go.

POST /v1/billing/portal

Authenticated. Stripe Customer Portal session for Pro subscribers.

POST /webhooks/stripe

Stripe signature required. checkout.session.completed upgrades the key to Pro using metadata.key_id or Payment Link client_reference_id.

Limits

PlanDistill units / dayMemory write / readRPM (key)RPM (IP)
Free50 fast200 / 100060120
Pro5,000 fast5,000 / 10,000600120