{"uid":"cap_ls6u_8zc0dr2pAE56ffWk","slug":"preflight-agentdiet-dev-web-url-html-distiller-with-bm25-budget-control-1b75244d","name":"Web URL & HTML 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/context-trimmer)","url":"https://preflight.agentdiet.dev/v1/context-trimmer?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_f43btzxsymGpE9DqapwdT","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 tokens with BM25-ranked budget trimming and multiple output modes","exampleAgentPrompt":"Can you fetch https://stripe.com/docs/payments and distill it into clean markdown, keeping it under 1500 tokens and focusing on the sections most relevant to 'payment intents'?","exampleUseCases":[{"title":"Token-budget research before LLM call","prompt":"Grab https://openai.com/research/gpt-4 and distill it in budget mode, focusing on 'model architecture', with a strict ceiling of 800 tokens — I need to fit it into my prompt without blowing my context window."},{"title":"Structured data extraction from a pricing page","prompt":"Distill https://vercel.com/pricing into structured mode so I get the pricing tiers and features as clean JSON tables, not a wall of HTML."},{"title":"Skeleton outline of long documentation","prompt":"Take this raw HTML from our internal wiki and give me a skeleton outline so I can see the heading structure and main sections without reading the whole thing."}],"resultDescription":"Returns a 'data' object containing the distilled content (markdown, structured JSON tables/metadata, skeleton outline, or BM25-ranked budget excerpt), along with an ROI proof object showing raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, and llm_cost_saved_usd. Also includes cache hit/miss status and billing details.","failureModes":["URL unreachable or returns non-200 — fetch error returned","HTML too short or empty — minimal or empty distillation output","max_tokens set below content minimum (under 20) — validation error","mode=budget used without providing a query — may return unranked or error","Token budget cannot be satisfied — returns best-effort truncation","Payment failure via x402 — 402 response, no distillation performed"],"whenToPreferThis":"Choose this endpoint when you need to reduce LLM token consumption from web content, especially when working with a strict context budget. The BM25 budget mode is uniquely suited for query-focused trimming where only the most relevant passage of a long page matters. Prefer over generic scrapers when you need ROI proof of compression savings or when the output must be in a specific mode (markdown, structured, skeleton). It also accepts raw HTML directly, making it useful when you've already fetched content and need to compress it without a second network call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T00:37:52.720Z","isFirstParty":false,"canonicalSlug":"preflight-agentdiet-dev-web-url-html-distiller-with-bm25-budget-control-ea17af2c"}