{"uid":"cap_uuKxH8SGvvNAAtbu9rX7E","slug":"onchain-risk-agentdiet-dev-web-content-distiller-with-bm25-budget-b217c9a7","name":"Web Content 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://onchain-risk.agentdiet.dev/v1/context-compress)","url":"https://onchain-risk.agentdiet.dev/v1/context-compress?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_n9hqzNh8iRV-7omUKQPi_","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"onchain-risk.agentdiet.dev","brandSlug":"onchain-risk-agentdiet-dev-mpp","brandBaseUrl":"https://onchain-risk.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and compresses a URL or raw HTML into compact, agent-ready tokens using configurable distillation modes including BM25-ranked budget excerpts","exampleAgentPrompt":"Can you distill https://stripe.com/docs/api into a BM25-focused excerpt about webhook events, keeping it under 800 tokens so I don't blow my context window?","exampleUseCases":[{"title":"Token-budget research on long docs","prompt":"Fetch https://docs.openai.com/assistants and give me only the parts about file search, capped at 500 tokens using BM25 budget mode focused on the query 'file search retrieval'."},{"title":"Structured extraction from a product page","prompt":"Distill https://aws.amazon.com/ec2/pricing/ into structured JSON tables and metadata — I need the pricing tiers in a clean format my agent can parse."},{"title":"Convert raw HTML to markdown for agent context","prompt":"I've got this raw HTML from a scraped competitor page — can you compress it into clean markdown so I can feed it into my agent without wasting a ton of context tokens?"}],"resultDescription":"Returns a 'data' object containing distilled content (markdown, structured JSON tables/metadata, skeleton outline, or BM25-ranked budget excerpt), plus an 'roi_proof' block showing raw vs distilled token counts, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and a ROI multiplier. Also includes optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 — endpoint may return an error status","HTML payload is empty or malformed — distillation may produce empty output","max_tokens set below minimum of 20 — validation error returned","BM25 query omitted when mode=budget — may return unfiltered or error response","Requested URL is behind a paywall or login wall — content may be inaccessible","Rate limit or payment failure via x402 — 402 response requiring valid USDC payment"],"whenToPreferThis":"Choose this endpoint when you need BM25-controlled, query-focused budget excerpts alongside standard markdown/structured/skeleton distillation modes — especially when you want quantified ROI proof (tokens saved, cost saved) and strict token ceiling enforcement. It is preferable over generic scraping APIs when token efficiency and LLM cost reduction are primary goals, or when you need to pass raw HTML directly without a fetch roundtrip.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T00:37:02.010Z","isFirstParty":false,"canonicalSlug":"onchain-risk-agentdiet-dev-web-content-distiller-with-bm25-budget-b217c9a7"}