{"uid":"cap_5MGKcIakrl28q3M9Thcia","slug":"sec-intel-agentdiet-dev-web-page-html-distiller-with-bm25-budget-cbd15591","name":"Web Page & 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://sec-intel.agentdiet.dev/v1/token-optimizer)","url":"https://sec-intel.agentdiet.dev/v1/token-optimizer?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_tAe7UiiGbC-TeJ9qJoq4T","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"sec-intel.agentdiet.dev","brandSlug":"sec-intel-agentdiet-dev-mpp","brandBaseUrl":"https://sec-intel.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and distills it into token-efficient markdown, structured JSON, outline skeleton, or a BM25-ranked budget excerpt — returning compression ROI metrics.","exampleAgentPrompt":"Distill the content at https://stripe.com/docs/payments into clean markdown and keep it under 800 tokens, focusing on payment intents — I want to see how much token cost I save.","exampleUseCases":[{"title":"Context-window-safe doc ingestion","prompt":"Fetch https://docs.openai.com/api-reference and distill it into structured markdown under 1000 tokens so I can include it in my prompt without hitting the context limit."},{"title":"BM25 focused research excerpt","prompt":"Pull the page at https://arxiv.org/abs/2305.10601 and give me only the sections most relevant to 'retrieval augmented generation' using budget mode, capped at 500 tokens."},{"title":"Raw HTML cleanup for agent pipeline","prompt":"I've got this raw HTML from a scraper — distill it into clean markdown so my agent can process it without wasting tokens on nav bars and footers."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (markdown, structured tables, skeleton, or BM25 excerpt depending on mode), an 'roi_proof' object showing raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, roi_multiplier, and llm_cost_saved_usd, plus optional cache hit/miss status and billing details.","failureModes":["URL unreachable or returns non-200 — fetch fails, status error returned","HTML input is empty or malformed — distillation produces minimal or empty output","max_tokens set too low (below 20) — validation error","BM25 query missing when mode=budget — may fall back to full distillation","Rate limit or payment failure (402) — call rejected without distilled content","URL is behind authentication/paywall — content inaccessible"],"whenToPreferThis":"Choose this endpoint when you need to reduce the token footprint of web content before feeding it to an LLM — especially when working with large documentation pages, financial filings, or news articles. It is uniquely valuable when you need a BM25-focused excerpt (budget mode with a query) to extract only the most relevant passages within a hard token ceiling. Prefer it over generic scrapers when you also want quantified ROI metrics (tokens saved, cost saved) to justify the preprocessing step in an agentic pipeline.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:37:10.144Z","isFirstParty":false,"canonicalSlug":"sec-intel-agentdiet-dev-web-page-html-distiller-with-bm25-budget-cbd15591"}