{"uid":"cap_VuGCbi7ig10s22-tL1Gk6","slug":"hn-pulse-agentdiet-dev-bm25-budget-controlled-web-distillation-bd1460ab","name":"BM25 Budget-Controlled Web Distillation (Context Compress)","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://hn-pulse.agentdiet.dev/v1/context-compress)","url":"https://hn-pulse.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_napBTY-HsPQygpz66ruWx","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"hn-pulse.agentdiet.dev","brandSlug":"hn-pulse-agentdiet-dev-mpp","brandBaseUrl":"https://hn-pulse.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a URL or raw HTML into compact, token-budget-constrained agent-ready content using BM25 ranking with multiple output modes","exampleAgentPrompt":"Can you distill https://stripe.com/docs/payments into compact markdown, staying under 800 tokens and focusing on anything about payment intents?","exampleUseCases":[{"title":"Fit research page into LLM context","prompt":"I need you to fetch https://arxiv.org/abs/2305.10601 and compress it down to at most 500 tokens in markdown mode so I can include it in my prompt without blowing the context window."},{"title":"BM25 excerpt for competitor analysis","prompt":"Pull the page at https://openai.com/pricing and extract only the parts relevant to my query 'fine-tuning costs per token', keeping the budget under 300 tokens."},{"title":"Distill raw HTML into structured tables","prompt":"I have this raw HTML from a financial report — can you distill it into structured JSON tables so it's easier to parse the revenue figures?"}],"resultDescription":"Returns a distilled version of the webpage or HTML in the requested mode (markdown, structured JSON, skeleton outline, or BM25 budget excerpt), along with an ROI proof object showing raw token count, distilled token count, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and optional cache hit/miss and billing metadata.","failureModes":["URL is unreachable or returns non-200 — fetch failure with error status","HTML payload is empty or malformed — no content to distill","max_tokens set below 20 — validation error","mode=budget used without providing a query — BM25 ranking has no target","Payment not received via x402 — 402 Payment Required response","Rate limiting or timeout on upstream URL fetch"],"whenToPreferThis":"Choose this endpoint when you need to fit web content into a strict LLM token budget, especially when you want BM25-ranked relevance filtering against a specific query. It is ideal for agentic workflows where raw web pages are too large for context windows and you want quantified ROI on compression. Prefer it over generic scrapers when you need structured output modes (markdown, JSON tables, skeleton) or when cost savings on LLM tokens matter.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:33:53.253Z","isFirstParty":false,"canonicalSlug":"hn-pulse-agentdiet-dev-bm25-budget-controlled-web-distillation-bd1460ab"}