{"uid":"cap_YxCMXyjIqXoyoSimNbnEA","slug":"shopify-intel-agentdiet-dev-rag-diet-bm25-budget-controlled-url-html-0e3249b6","name":"RAG Diet – BM25 Budget-Controlled URL/HTML Distillation","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://shopify-intel.agentdiet.dev/v1/rag-diet)","url":"https://shopify-intel.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_Ydeaj8v_Lzj0Mo2ulM_4Q","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"shopify-intel.agentdiet.dev","brandSlug":"shopify-intel-agentdiet-dev-mpp","brandBaseUrl":"https://shopify-intel.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a URL or raw HTML payload into compact, agent-ready tokens using BM25 relevance scoring with a strict token budget ceiling.","exampleAgentPrompt":"Distill the page at https://shopify.dev/docs/api/admin-rest focusing on 'product variants' and keep it under 500 tokens using budget mode so I can fit it into my LLM context.","exampleUseCases":[{"title":"RAG pipeline web page grounding","prompt":"Fetch https://stripe.com/docs/payments/accept-a-payment and distill it in budget mode with the query 'accept card payments' capped at 300 tokens so I can ground my agent's answer without blowing my context window."},{"title":"Structured data extraction from product page","prompt":"Pull the page at https://www.shopify.com/pricing and convert it into structured mode so I get clean JSON tables of all the plan names, prices, and features."},{"title":"Skeleton outline of long documentation","prompt":"Distill https://docs.github.com/en/actions into skeleton mode so I just get the high-level section headings and outline without all the verbose detail — I want to navigate the structure quickly."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (Markdown, structured JSON, skeleton outline, or BM25 excerpt depending on mode), plus an 'roi_proof' object showing raw token count, distilled token count, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and ROI multiplier. Also includes optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 status — distillation fails with an error status","max_tokens set too low (below 20) — rejected by schema validation","BM25 query provided without mode=budget — query may be ignored or trigger unexpected behavior","Raw HTML payload is malformed or empty — distillation returns minimal or empty output","Payment (x402 HTTP 402) fails or USDC balance is insufficient — request blocked before processing","Rate limiting or server overload causing slow or failed fetch of target URL"],"whenToPreferThis":"Choose this endpoint when you need to compress a specific webpage or raw HTML into a strict token budget before feeding it to an LLM, especially when BM25-relevance-ranked extraction matters (i.e. you have a focus query). Prefer it over a generic web scraper when token cost and ROI measurement are important, or when you need mode flexibility (Markdown, structured JSON, skeleton, or budget). It's ideal for RAG pipelines where context window space is limited and you need provable compression metrics.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:37:32.457Z","isFirstParty":false,"canonicalSlug":"shopify-intel-agentdiet-dev-rag-diet-bm25-budget-controlled-url-html-0e3249b6"}