{"uid":"cap_uqAAn_mfmGZ_9bMau7nJG","slug":"domain-osint-agentdiet-dev-web-distillation-bm25-budget-controlled-511c6a94","name":"Web Distillation & BM25 Budget-Controlled Token Optimizer","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://domain-osint.agentdiet.dev/v1/token-optimizer)","url":"https://domain-osint.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_eqFOsUMXzdZcx8HpMollC","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"domain-osint.agentdiet.dev","brandSlug":"domain-osint-agentdiet-dev-mpp","brandBaseUrl":"https://domain-osint.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or processes raw HTML and distills it into compressed Markdown, structured JSON, a skeleton outline, or a BM25-ranked token-budget excerpt","exampleAgentPrompt":"Fetch https://stripe.com/docs/payments/payment-intents and distill it into clean markdown using budget mode with a max of 500 tokens, focused on the query 'how to confirm a payment intent'.","exampleUseCases":[{"title":"Token-budget doc fetch for agent context","prompt":"Grab https://docs.openai.com/api-reference and compress it into under 800 tokens using budget mode, focused on the query 'rate limits', so I can include it in my prompt without blowing my context window."},{"title":"Clean markdown extraction from a news article","prompt":"Distill https://techcrunch.com/2024/05/10/some-article into clean markdown — strip all the ads, nav, and boilerplate so I just get the actual article text."},{"title":"Structured data extraction from a pricing page","prompt":"Take the raw HTML of this SaaS pricing page and convert it into structured JSON tables so I can compare the plan tiers: <html>...</html> — use structured mode."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25-ranked 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 cache status (HIT/MISS) and billing details.","failureModes":["URL is unreachable or returns a non-200 status — endpoint may return an error status","HTML payload is empty or malformed — distillation may produce minimal output","max_tokens set too low for meaningful content extraction — result may be truncated","BM25 query in budget mode finds no relevant sections — returns lowest-scoring content","Payment not completed via x402 — request blocked before processing","Rate limit or timeout fetching a slow target URL"],"whenToPreferThis":"Choose this endpoint when an AI agent needs to process web content within a strict token budget, reduce LLM API costs by compressing pages before sending to a model, or extract only query-relevant sections of a large webpage. Particularly valuable when processing documentation sites, news articles, or any HTML-heavy page where raw content would be too large for a context window. Prefer over generic scrapers when you need built-in BM25 relevance filtering and ROI metrics showing exactly how many tokens and dollars were saved.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:34:31.506Z","isFirstParty":false,"canonicalSlug":"domain-osint-agentdiet-dev-web-distillation-bm25-budget-controlled-511c6a94"}