{"uid":"cap_uJXCXVjzimVd_a07zA16R","slug":"agentdiet-dev-distill-url-or-html-to-markdown-with-bm25-budget-control-4be02796","name":"Distill URL or HTML to Markdown 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://agentdiet.dev/v1/docs-to-markdown)","url":"https://agentdiet.dev/v1/docs-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_JRu4jeKs4AjsBFOJcwOUQ","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"agentdiet.dev","brandSlug":"agentdiet-dev-mpp","brandBaseUrl":"https://agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and converts it to compressed Markdown, structured JSON, a skeleton outline, or a BM25-focused token-budgeted excerpt.","exampleAgentPrompt":"Can you fetch https://stripe.com/docs/payments and distill it into clean markdown, keeping it under 2000 tokens and focusing on the query 'payment intents setup'?","exampleUseCases":[{"title":"Compress docs to fit LLM context","prompt":"Grab the OpenAI API docs at https://platform.openai.com/docs/guides/embeddings and distill them into markdown — I only have about 3000 tokens to spare, so please use budget mode focused on the query 'embedding dimensions'."},{"title":"Extract structured data from product page","prompt":"Take the raw HTML from this Amazon product listing and convert it to structured JSON tables with the metadata and specs — I need the tables and pricing info pulled out cleanly."},{"title":"Outline a long technical document","prompt":"Fetch https://docs.aws.amazon.com/ec2/latest/userguide and give me a skeleton outline of the page so I can see the section headers without reading the whole thing."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled output (Markdown text, structured JSON tables, skeleton outline, or BM25-focused excerpt depending on mode), plus 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 HTTP status — endpoint may return an error status","HTML payload is empty or malformed — distillation may produce empty or low-quality output","max_tokens set too low for meaningful content — may return a very truncated or empty excerpt","BM25 query not relevant to page content — budget mode may return irrelevant fragments","Payment not provided or insufficient — x402 payment required error returned","Rate limit or timeout on fetching large pages — latency spike or failure"],"whenToPreferThis":"Choose this endpoint when you need to feed web content into an LLM but want to minimize token usage and cost. It is especially useful when you have a strict token budget and want BM25-ranked relevance filtering, or when you need structured JSON tables and metadata extracted from HTML rather than raw text. Prefer it over generic scrapers when ROI proof and compression metrics matter, or when you need multiple output modes (markdown, structured, skeleton, budget) from the same service.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:36:44.043Z","isFirstParty":false,"canonicalSlug":"agentdiet-dev-distill-url-or-html-to-markdown-with-bm25-budget-control-4be02796"}