{"uid":"cap_ZYh74RY4ZGgnOZDVkWNTg","slug":"preflight-agentdiet-dev-semantic-html-pruner-with-bm25-budget-control-2b4d8d44","name":"Semantic HTML Pruner 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/semantic-html-pruner)","url":"https://preflight.agentdiet.dev/v1/semantic-html-pruner?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_O0-LeL24GRDsY_qpy_BlJ","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, token-efficient agent-ready content using BM25-scored budget pruning across multiple distillation modes","exampleAgentPrompt":"Fetch https://stripe.com/docs/payments and distill it into compact markdown using budget mode, focused on 'webhook event handling', with a max of 800 tokens.","exampleUseCases":[{"title":"LLM context window cost reduction","prompt":"Pull https://docs.openai.com/api-reference and compress it into markdown, budget mode with query 'rate limits and pricing', capping at 500 tokens — I want to feed it to GPT-4 cheaply."},{"title":"Focused research snippet extraction","prompt":"Distill https://en.wikipedia.org/wiki/Transformer_(machine_learning_model) in budget mode with the query 'attention mechanism self-attention', max 600 tokens, so I only get the relevant section."},{"title":"Agent doc ingestion from raw HTML","prompt":"I have a raw HTML blob from a scraped product page — distill it into structured JSON tables and metadata so my agent can parse the pricing and specs without wading through all the markup."}],"resultDescription":"Returns a JSON object with distilled content (Markdown, structured JSON, skeleton outline, or BM25-focused excerpt depending on mode), an ROI proof block showing raw vs distilled token counts, compression ratio, estimated LLM cost saved, and optional cache status and billing info.","failureModes":["URL is unreachable or returns non-200 — distillation fails with an error status","HTML payload is empty or malformed — may return empty or minimal distilled output","mode=budget without a query or max_tokens — BM25 ranking has no focus signal","Token budget too small (below 20) — rejected by schema validation","Rate limit or payment failure via x402 — billing error returned","Target site blocks automated fetching (bot protection) — fetch fails or returns CAPTCHA page"],"whenToPreferThis":"Choose this endpoint when you need to feed live web content to an LLM but want to minimize token usage and cost. It is especially valuable when only a subset of a page is relevant (use budget mode + BM25 query), or when you need structured tables and metadata rather than raw HTML. Prefer it over general scraping tools when token budget control and ROI proof are required — the compression ratio reporting makes it easy to justify cost savings to downstream systems.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:38:27.037Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-semantic-html-pruner-with-bm25-budget-control-2b4d8d44"}