{"uid":"cap_jQjaPpnsdbh9WiPZIqV4L","slug":"hn-pulse-agentdiet-dev-prompt-compress-bm25-budget-controlled-web-d86109f0","name":"Prompt Compress: BM25 Budget-Controlled Web Distillation","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/prompt-compress)","url":"https://hn-pulse.agentdiet.dev/v1/prompt-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_X8dPRAN-B1Yb7zzKUcuqy","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 a URL or accepts raw HTML and distills it into compact, token-budgeted agent-ready content using BM25 query-focused extraction","exampleAgentPrompt":"Fetch https://stripe.com/docs/payments and distill it in budget mode focused on the query 'webhook event handling', keeping it under 500 tokens, so I can include it in my prompt without blowing my context window.","exampleUseCases":[{"title":"Token-budget research briefing","prompt":"Grab https://en.wikipedia.org/wiki/Transformer_(machine_learning_model) and compress it in budget mode with the query 'attention mechanism', capped at 300 tokens — I need just the relevant bits for my prompt."},{"title":"Stripe docs distillation for coding agent","prompt":"Distill the Stripe docs at builtin://stripe-docs into structured mode so my coding agent gets all the API tables and metadata in a compact, machine-readable format."},{"title":"Raw HTML cleanup for pipeline","prompt":"I have a raw HTML blob from a scraped product page — can you distill it into clean markdown and tell me how many tokens were saved versus the original?"}],"resultDescription":"Returns a 'data' object containing the distilled content (markdown, structured JSON, skeleton outline, or BM25-focused excerpt depending on mode), plus an 'roi_proof' object showing raw token count, distilled token count, tokens saved, compression ratio percentage, LLM cost saved in USD, and ROI multiplier. Also includes optional cache hit/miss status and billing details.","failureModes":["URL fetch failure if the target page is blocked, rate-limited, or returns non-200 status","Token budget too low (max_tokens < 20) returns validation error","Missing required 'url' field returns 400 bad request","BM25 query not provided when mode=budget may return unfiltered distillation","Payment failure via x402 if insufficient USDC balance","Large pages may exceed processing limits or increase latency","HTML input that is malformed or empty returns minimal output"],"whenToPreferThis":"Choose this endpoint when you need to reduce a webpage or HTML payload to fit within a strict LLM token budget, especially when BM25 query-focused extraction is needed to pull only the most relevant content. It is ideal for agentic pipelines where raw web content is too large for the context window, or when you want structured/skeleton distillation with quantified ROI (tokens saved, cost saved). Prefer it over generic scraping endpoints when token efficiency and compression metrics matter.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:40:25.008Z","isFirstParty":false,"canonicalSlug":"hn-pulse-agentdiet-dev-prompt-compress-bm25-budget-controlled-web-d86109f0"}