{"uid":"cap_0qozYzmgxpTwYV4R7ZuXa","slug":"serp-extract-agentdiet-dev-distill-url-or-html-with-bm25-budget-control-78eeb859","name":"Distill URL or HTML with BM25 Budget Control","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://serp-extract.agentdiet.dev/v1/context-diet)","url":"https://serp-extract.agentdiet.dev/v1/context-diet?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_BQbe3JWGhiTZGKTN_3TDd","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"serp-extract.agentdiet.dev","brandSlug":"serp-extract-agentdiet-dev-mpp","brandBaseUrl":"https://serp-extract.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches and distills a webpage URL or raw HTML into compact, token-efficient agent-ready content using BM25 scoring for query-focused budget-controlled extraction.","exampleAgentPrompt":"Grab the page at https://docs.stripe.com/payments/checkout and distill it into budget mode with the query 'payment intents' keeping it under 500 tokens — I want just the most relevant content without the bloat.","exampleUseCases":[{"title":"Token-budget research on documentation","prompt":"Pull the content from https://openai.com/api and distill it in budget mode focused on the query 'rate limits and pricing', with a max of 800 tokens — I need just the relevant bits for my agent to read."},{"title":"Structured data extraction from landing page","prompt":"Take this URL https://example.com/pricing and distill it in structured mode so I can get the pricing tiers and feature tables as clean JSON without all the nav and footer noise."},{"title":"Compress pasted HTML for LLM context","prompt":"I have some raw HTML from a competitor's product page — can you distill it into markdown mode and tell me how many tokens it saves compared to the original?"}],"resultDescription":"Returns a distilled content object (markdown, structured JSON, skeleton outline, or BM25-focused excerpt depending on mode), plus an roi_proof block showing raw vs. distilled token counts, tokens saved, compression ratio percentage, LLM cost saved in USD, and ROI multiplier. Also includes cache status (HIT/MISS) and billing details.","failureModes":["Missing required 'url' field returns validation error","Invalid or unreachable URL causes fetch failure","mode=budget without a 'query' field may return unfiltered or error response","max_tokens below minimum (20) rejected with schema validation error","Rate limiting or payment failure (HTTP 402) if USDC balance insufficient","Very large HTML payloads may time out or exceed processing limits"],"whenToPreferThis":"Choose this endpoint when you need to read a webpage but must stay within a strict token budget, especially with BM25 query-focused filtering to extract only the most relevant content. It is superior to generic scrapers when LLM cost savings and compression ROI are important, or when you want structured/skeleton output rather than raw HTML. Prefer it over basic URL-to-markdown converters when you need provable token savings metrics.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:30:08.514Z","isFirstParty":false,"canonicalSlug":"serp-extract-agentdiet-dev-distill-url-or-html-with-bm25-budget-control-d9536b23"}