{"uid":"cap_s9CfGRXQ3x4CRsmq7FaRK","slug":"alpha-stream-agentdiet-dev-agentdiet-context-compress-bm25-budget-79c078ed","name":"AgentDiet Context Compress — BM25 Budget-Controlled Web Distiller","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://alpha-stream.agentdiet.dev/v1/context-compress)","url":"https://alpha-stream.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_mvggXf0bIL0oktYNjHXTF","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"alpha-stream.agentdiet.dev","brandSlug":"alpha-stream-agentdiet-dev-mpp","brandBaseUrl":"https://alpha-stream.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and distills it into compact, agent-ready tokens using BM25 ranking with a configurable token budget ceiling","exampleAgentPrompt":"Fetch the page at https://docs.stripe.com/payments/checkout and distill it in budget mode focused on 'payment intents', keeping it under 500 tokens, so I can pass the most relevant content to my LLM without blowing my context window.","exampleUseCases":[{"title":"Documentation page for LLM context","prompt":"Grab the React docs page at https://react.dev/reference/react/useState and distill it into markdown under 800 tokens — I want only the most relevant content so I can include it in my prompt without hitting the limit."},{"title":"Query-focused competitor research","prompt":"Distill https://www.competitor.com/pricing into budget mode with the query 'enterprise plan features' and cap it at 300 tokens — I just need the parts most relevant to enterprise pricing."},{"title":"Raw HTML skeleton for agent parsing","prompt":"I've got this raw HTML from a scraped article — can you run it through skeleton mode so I get just the outline structure without all the body text? Here's the HTML: <html>...</html>"}],"resultDescription":"Returns a JSON object containing the distilled content (markdown, structured tables, skeleton outline, or BM25-ranked budget excerpt depending on mode), plus an roi_proof block showing raw token count, distilled token count, tokens saved, compression ratio percentage, and estimated LLM cost saved in USD. Also includes cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 — fetch failure with error status","URL parameter missing — validation error since it is required","max_tokens below minimum of 20 — schema validation rejection","BM25 query missing when mode=budget — may return unranked or error response","Raw HTML too large — possible timeout or truncation","Payment failure via x402 — 402 response if payment not attached","Invalid mode enum value — schema validation error"],"whenToPreferThis":"Choose this endpoint when you need to compress a specific web page or raw HTML payload into a token-efficient representation before feeding it to an LLM, especially when you have a strict token budget or a specific query focus. The BM25 budget mode is particularly valuable when you want only the most query-relevant passages from a long page. Prefer this over generic scrapers when token economy and LLM cost savings are a priority, and when you need structured proof of compression ROI.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:31:02.024Z","isFirstParty":false,"canonicalSlug":"alpha-stream-agentdiet-dev-agentdiet-context-compress-bm25-budget-79c078ed"}