{"uid":"cap_jXwfKUUKk3i8xCKl-Luo7","slug":"preflight-agentdiet-dev-distill-url-or-html-with-bm25-budget-control-21b61525","name":"Distill URL or HTML with BM25 Budget Control","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://preflight.agentdiet.dev/v1/markdown-distill)","url":"https://preflight.agentdiet.dev/v1/markdown-distill?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","minLength":1,"description":"Target webpage URL to fetch and distill (or builtin://stripe-docs)"},"html":{"type":"string","description":"Optional raw HTML string to distill directly without fetching"},"mode":{"enum":["markdown","structured","skeleton","budget"],"type":"string","default":"markdown","description":"Distillation mode"},"query":{"type":"string","description":"BM25 focus query when mode=budget"},"max_tokens":{"type":"integer","minimum":20,"description":"Strict token budget ceiling when mode=budget"}}},"responseSchema":{"type":"object","required":["status","roi_proof","data"],"properties":{"data":{"type":"object","description":"Distilled Markdown, structured JSON tables/metadata, skeleton outline, or BM25 budget excerpt."},"cache":{"type":"object","properties":{"status":{"enum":["HIT","MISS"],"type":"string"},"cache_key":{"type":"string"},"latency_ms":{"type":"number"}}},"status":{"type":"string","description":"Execution status ('ok')"},"billing":{"type":"object","properties":{"agent_id":{"type":"string"},"payment_method":{"type":"string"},"fee_charged_usd":{"type":"number"}}},"roi_proof":{"type":"object","properties":{"raw_tokens":{"type":"integer"},"tokens_saved":{"type":"integer"},"roi_multiplier":{"type":"number"},"distilled_tokens":{"type":"integer"},"llm_cost_saved_usd":{"type":"number"},"compression_ratio_pct":{"type":"number"}}}}},"example":null,"exampleRequest":null,"tags":[],"displayCostAmount":"0.001","displayCostAsset":"USD","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_x-tXxuA7Ew05CD6nb4xWT","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"preflight.agentdiet.dev","brandSlug":"preflight-agentdiet-dev-mpp","brandBaseUrl":"https://preflight.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and distills it into compact, agent-ready Markdown with optional BM25 relevance-ranked token budget control","exampleAgentPrompt":"Fetch https://stripe.com/docs/api and distill it into compact markdown using budget mode, focused on 'webhook events', and keep it under 800 tokens.","exampleUseCases":[{"title":"Summarize documentation page for agent","prompt":"Pull the content from https://docs.anthropic.com/en/api/getting-started and distill it into clean markdown so I can pass it to my agent without blowing my token budget."},{"title":"BM25-focused excerpt from news article","prompt":"Grab the article at https://techcrunch.com/2025/01/10/openai-new-model and distill it in budget mode, focused on 'GPT-5 release date', capped at 500 tokens."},{"title":"Convert raw HTML to structured tables","prompt":"I have raw HTML from a financial report page — can you distill it in structured mode to extract the tables and metadata into clean JSON?"}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (Markdown, structured JSON, skeleton outline, or BM25 excerpt depending on mode), along with an 'roi_proof' object showing raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, roi_multiplier, and llm_cost_saved_usd. Also includes optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 — fetch failure error","URL resolves to non-HTML content (PDF, binary) — unsupported content type","max_tokens set too low (below 20) — schema validation error","BM25 query provided but mode is not 'budget' — query ignored or misused","Raw HTML too large — possible timeout or truncation","Payment not included or insufficient — HTTP 402 response blocking execution"],"whenToPreferThis":"Use this endpoint when an AI agent needs to ingest web content but must stay within a token budget, reduce LLM inference costs, or extract only the most relevant passages from a large page. It is especially valuable when the target page is noisy, ad-heavy, or extremely long. Prefer the BM25 budget mode when you have a specific query focus and a hard token ceiling. Prefer structured or skeleton mode when you need tables, metadata, or a document outline rather than prose. Choose this over generic scrapers when token efficiency and LLM cost savings are explicit goals.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T06:38:03.439Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-distill-url-or-html-with-bm25-budget-control-2f1ac22b"}