{"uid":"cap_MK-3qA3k8F3rEFwUwy6vq","slug":"llms-generator-agentdiet-dev-prompt-compress-bm25-budget-controlled-e932158e","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://llms-generator.agentdiet.dev/v1/prompt-compress)","url":"https://llms-generator.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_YGG8dlAYmgeuu8hLXgPWP","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"llms-generator.agentdiet.dev","brandSlug":"llms-generator-agentdiet-dev-mpp","brandBaseUrl":"https://llms-generator.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and distills it into compact agent-ready tokens using BM25 scoring with strict token budget control","exampleAgentPrompt":"Distill https://stripe.com/docs/payments into a focused excerpt about payment intents using BM25 budget mode, keeping it under 500 tokens.","exampleUseCases":[{"title":"Fitting Docs Into Agent Context","prompt":"Grab the content from https://docs.openai.com/guides/function-calling and compress it to under 800 tokens using budget mode, focusing on the query 'tool calling parameters'."},{"title":"Extracting Relevant News Without Token Waste","prompt":"Distill this URL https://techcrunch.com/latest into structured markdown, keeping only the most relevant parts about AI funding — use budget mode with a 600 token ceiling."},{"title":"Summarizing Raw HTML From Scraped Page","prompt":"I have raw HTML from a competitor's pricing page — distill it into a structured JSON table of their pricing tiers without fetching anything, using structured mode."}],"resultDescription":"Returns a distilled payload (markdown text, structured JSON tables/metadata, skeleton outline, or BM25-ranked 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 a cache status indicator.","failureModes":["Missing or invalid URL returns a validation error","URL fetch fails due to network error or blocked access","BM25 budget mode without a query string may produce degraded relevance ranking","max_tokens set below minimum of 20 causes a schema validation error","Payment failure via x402 blocks execution","Raw HTML that is malformed or empty may return empty distilled output"],"whenToPreferThis":"Choose this endpoint when you need fine-grained control over token budgets and want BM25-based relevance filtering to extract only the most query-relevant content from a page. It is superior to a plain URL-to-markdown distiller when you have a specific focus query and a hard token limit, or when you want structured/skeleton output rather than raw markdown. Particularly useful for agentic pipelines where context window management is critical and LLM cost savings need to be tracked.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T12:36:40.191Z","isFirstParty":false,"canonicalSlug":"llms-generator-agentdiet-dev-prompt-compress-bm25-budget-controlled-e932158e"}