{"uid":"cap_5cFY6pg50ha6VQanxNEeI","slug":"agentdiet-dev-agentdiet-rag-chunk-url-html-distiller-with-bm25-budget-174ddee9","name":"AgentDiet RAG Chunk – 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://agentdiet.dev/v1/rag-chunk)","url":"https://agentdiet.dev/v1/rag-chunk?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_Lg9XS9b-cTAgUl1fHar9b","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"agentdiet.dev","brandSlug":"agentdiet-dev-mpp","brandBaseUrl":"https://agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a webpage URL or raw HTML into compressed Markdown, structured JSON, a skeleton outline, or a BM25-ranked token-budget excerpt focused on a specific query","exampleAgentPrompt":"Distill the content at https://stripe.com/docs/payments into clean Markdown using budget mode, focused on the query 'payment intents', and cap the output at 500 tokens so I don't blow my context window.","exampleUseCases":[{"title":"RAG ingestion with token budget","prompt":"Fetch https://openai.com/research/gpt-4 and distill it in budget mode focused on the query 'multimodal capabilities', keeping the output under 300 tokens so it fits into my RAG pipeline without exceeding my LLM context limit."},{"title":"Structured extraction from competitor page","prompt":"Pull the content from https://anthropic.com/claude and return it as structured JSON tables — I want to see pricing, model names, and feature comparisons extracted cleanly without all the HTML cruft."},{"title":"Skeleton outline of documentation page","prompt":"Give me a skeleton outline of https://docs.github.com/en/actions so I can see the high-level structure and section headings before I decide which parts to read in detail."}],"resultDescription":"Returns a JSON object containing the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25-ranked excerpt depending on mode), an ROI proof block showing raw vs distilled token counts, compression ratio, and estimated LLM cost saved, plus optional billing and cache hit/miss metadata.","failureModes":["URL is unreachable or returns a non-200 status — service may return an error status","HTML payload is empty or malformed — distillation may produce minimal output","mode=budget used without a query parameter — BM25 ranking cannot focus without a query","max_tokens set too low — may truncate content aggressively or return an error","Payment not attached (x402) — returns HTTP 402 requiring USDC micropayment","Target page is paywalled or requires authentication — fetched HTML will be login-gated content only"],"whenToPreferThis":"Choose this endpoint when you need to ingest web content into an LLM pipeline and want to minimize token consumption — especially when using mode=budget with a query and max_tokens to stay within strict context limits. Prefer it over raw fetch-and-pass approaches when LLM cost or context window size is a concern. Also ideal when you need structured JSON or skeleton outlines rather than raw HTML, or when you want ROI proof of how many tokens were saved.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:37:32.743Z","isFirstParty":false,"canonicalSlug":"agentdiet-dev-agentdiet-rag-chunk-url-html-distiller-with-bm25-budget-174ddee9"}