{"uid":"cap_0Tnp4Dw2K_tVrUUZpzvMr","slug":"preflight-agentdiet-dev-url-html-to-markdown-distiller-with-bm25-e4181ed9","name":"URL/HTML to Markdown Distiller 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/url-to-markdown)","url":"https://preflight.agentdiet.dev/v1/url-to-markdown?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_xkyweVzaPMpKo_PRYPOZL","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 and distills a URL or raw HTML into compact, agent-ready Markdown with optional BM25 keyword-focused token budget trimming","exampleAgentPrompt":"Distill the content at https://stripe.com/docs/api into clean markdown, focusing on 'authentication headers' and keep it under 500 tokens using budget mode.","exampleUseCases":[{"title":"LLM cost reduction for web research","prompt":"Fetch the article at https://techcrunch.com/2025/01/15/openai-funding and distill it into compact markdown — I want to keep token usage as low as possible, so use budget mode with a 300 token ceiling and focus the BM25 query on 'funding valuation investors'."},{"title":"Agent context loading from documentation","prompt":"Grab the Stripe API docs from https://stripe.com/docs/api and convert them to structured markdown so my agent can read the key tables and metadata without burning through my LLM context window."},{"title":"Raw HTML cleanup without fetching","prompt":"I have a raw HTML blob from a scraped page — can you distill it directly into clean, readable markdown without re-fetching anything? I'll paste the HTML in the html field."}],"resultDescription":"Returns a JSON object containing the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25 budget excerpt depending on mode), plus an roi_proof block showing raw vs distilled token counts, compression ratio percentage, tokens saved, and estimated LLM cost saved in USD. Also includes cache hit/miss status, cache latency, and billing metadata.","failureModes":["URL is unreachable or returns non-200 — fetch fails with an error status","HTML payload is empty or malformed — distillation returns empty or low-quality output","max_tokens set below 20 — rejected with validation error","BM25 query provided without mode=budget — query may be ignored","Rate limit or payment failure — HTTP 402 returned if payment not satisfied","Target page is JavaScript-rendered SPA — static fetch may miss dynamic content","Token budget too small relative to page size — output may be truncated aggressively"],"whenToPreferThis":"Choose this endpoint when you need to reduce the token footprint of web content before passing it to an LLM — especially when you want BM25 keyword-focused excerpting to stay within a strict token budget. Prefer it over generic scrapers when you care about compression ratio reporting and LLM cost savings. The budget mode with a focus query is uniquely suited for RAG pipelines and research agents that need only the most relevant portion of a large page. Use the html input when you already have the raw HTML and want to avoid a redundant HTTP fetch.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T00:37:02.856Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-url-html-to-markdown-distiller-with-bm25-e4181ed9"}