{"uid":"cap_lPzbz_BAyunXvrdBdqFNq","slug":"mesh-agentdiet-dev-rag-diet-url-html-distiller-with-bm25-budget-control-f6f8ad99","name":"RAG-Diet: 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://mesh.agentdiet.dev/v1/rag-diet)","url":"https://mesh.agentdiet.dev/v1/rag-diet?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_LkfeTqsSFfg7ySZZuE2Dd","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"mesh.agentdiet.dev","brandSlug":"mesh-agentdiet-dev-mpp","brandBaseUrl":"https://mesh.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills any URL or raw HTML into compact Markdown, structured JSON, skeleton outline, or BM25-focused token-budget excerpt for LLM consumption","exampleAgentPrompt":"Distill the content at https://stripe.com/docs/payments into markdown mode and keep it under 800 tokens, focusing on 'payment intents setup' so I can feed just the relevant bits to my LLM without blowing my context window.","exampleUseCases":[{"title":"RAG pipeline context trimming","prompt":"Fetch https://openai.com/research/gpt-4 and distill it in budget mode with the query 'multimodal capabilities' and a max of 500 tokens — I need only the relevant excerpt for my RAG pipeline."},{"title":"Stripe docs for agent onboarding","prompt":"Distill the Stripe documentation into clean markdown using the builtin://stripe-docs URL so my agent can reference payment integration steps without consuming thousands of tokens."},{"title":"Structured data extraction from HTML","prompt":"I've got some raw HTML from a product listing page — can you distill it into structured mode to pull out the tables and metadata so I can parse pricing and specs programmatically?"}],"resultDescription":"Returns a JSON object containing: distilled content (Markdown string, structured JSON tables/metadata, skeleton outline, or BM25-focused excerpt) in `data`; ROI proof metrics including raw token count, distilled token count, tokens saved, compression ratio %, and estimated LLM cost saved in USD; optional cache hit/miss status with latency; and billing details including fee charged ($0.001 USD per call).","failureModes":["URL is unreachable or returns non-200 — distillation fails with error status","Raw HTML is malformed or empty — returns empty or minimal distillation","mode=budget used without a query field — BM25 ranking cannot be performed","max_tokens set below minimum of 20 — validation error","Target page is heavily JavaScript-rendered and server-side fetch returns shell HTML — poor distillation quality","Network timeout on slow or large pages — partial or failed response"],"whenToPreferThis":"Choose this endpoint when you need to feed web content into an LLM efficiently and want provable token savings with compression metrics. It is especially valuable in RAG pipelines where context budget matters, when you need BM25-ranked relevance filtering within a strict token ceiling, or when you want structured JSON tables/metadata extracted from HTML rather than raw text dumps. Prefer it over generic web scrapers when token economy and LLM cost reduction are primary concerns.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:31:45.923Z","isFirstParty":false,"canonicalSlug":"mesh-agentdiet-dev-rag-diet-url-html-distiller-with-bm25-budget-control-f6f8ad99"}