{"uid":"cap_lt2rq_SuwD0mgMSeDrVdz","slug":"agentdiet-dev-agentdiet-prompt-compress-bm25-budget-controlled-web-5d8c063d","name":"AgentDiet 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://agentdiet.dev/v1/prompt-compress)","url":"https://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_XtCTO47GLS-n31DBc-EIB","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"agentdiet.dev","brandSlug":"agentdiet-dev-mpp","brandBaseUrl":"https://agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a URL or raw HTML into compressed Markdown, structured JSON, skeleton outline, or BM25-focused budget excerpt with token savings proof","exampleAgentPrompt":"Distill the content at https://stripe.com/docs/payments into focused markdown about payment intents, staying under 800 tokens using BM25 budget mode — I want to know how much token cost this saves me.","exampleUseCases":[{"title":"Compress long doc before LLM call","prompt":"Fetch and compress https://docs.openai.com/api-reference into structured markdown, keeping it under 1000 tokens — focus the BM25 query on 'rate limits' so I only get the relevant parts."},{"title":"Distill raw HTML product page","prompt":"I have a raw HTML dump of a product listing page — distill it into clean structured JSON tables and metadata so I can pass it to my agent without blowing the context window."},{"title":"Outline a research article cheaply","prompt":"Give me a skeleton outline of https://arxiv.org/abs/2401.00001 so I can quickly see the paper's structure and section headers without loading the full text into my LLM context."}],"resultDescription":"Returns a `data` object containing the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25-focused budget excerpt), plus an `roi_proof` object showing raw token count, distilled token count, tokens saved, compression ratio percentage, and estimated LLM cost saved in USD. Also includes optional cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns non-200 — distillation fails with fetch error","HTML payload is empty or malformed — returns error status","max_tokens set too low (below 20) — rejected by schema validation","mode=budget requested without a query — BM25 scoring has no focus, may return degraded results","Rate limiting or payment failure via x402 — request blocked","Target page is JavaScript-heavy SPA with no static HTML — distillation quality degrades significantly"],"whenToPreferThis":"Choose this endpoint when you need to compress web content before inserting it into an LLM prompt — especially when working with long documentation pages, articles, or HTML dumps that would otherwise exceed context window limits or inflate LLM costs. Prefer it over raw scraping when you need token-budget control, BM25 query-focused relevance filtering, or structured/skeleton output modes. Ideal for autonomous agents that need to read many web pages cheaply.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:34:26.178Z","isFirstParty":false,"canonicalSlug":"agentdiet-dev-agentdiet-prompt-compress-bm25-budget-controlled-web-5d8c063d"}