{"uid":"cap_M3xnlFpuo2minUOe5yYXI","slug":"polymarket-odds-agentdiet-dev-web-distillation-with-bm25-budget-control-8f1aaedb","name":"Web Distillation 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://polymarket-odds.agentdiet.dev/v1/pdf-extract)","url":"https://polymarket-odds.agentdiet.dev/v1/pdf-extract?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_Sp16ogqU8FiDcIH80Rw95","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"polymarket-odds.agentdiet.dev","brandSlug":"polymarket-odds-agentdiet-dev-mpp","brandBaseUrl":"https://polymarket-odds.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or accepts raw HTML and distills it into Markdown, structured JSON, a skeleton outline, or a BM25-ranked token-budget excerpt","exampleAgentPrompt":"Distill https://stripe.com/docs/api into clean markdown using budget mode, focus the BM25 query on 'payment intents', and cap it at 2000 tokens so I can fit it into my context window.","exampleUseCases":[{"title":"Token-budget research on a competitor pricing page","prompt":"Grab https://www.notion.so/pricing and distill it in budget mode with a BM25 query for 'team plan pricing', keeping it under 500 tokens so I can compare costs without blowing my context."},{"title":"Structured table extraction from a news article","prompt":"Take this raw HTML from a financial news page and extract it in structured mode so I get all the tables and metadata as clean JSON — here's the HTML: <html>...</html>"},{"title":"Skeleton outline of a long documentation page","prompt":"Fetch https://docs.aws.amazon.com/lambda/latest/dg/welcome.html and give me a skeleton outline so I can quickly understand the document structure without reading the full thing."}],"resultDescription":"Returns a distilled version of the webpage or HTML in the requested mode (Markdown text, structured JSON with tables/metadata, skeleton outline, or BM25-ranked excerpt), along with ROI proof metrics 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 info.","failureModes":["URL is unreachable or returns non-200 status — endpoint may return an error status","HTML is malformed or empty — distillation may return minimal or empty content","Token budget too small (below 20) — rejected by schema validation","BM25 query missing when mode=budget — may return unranked or default content","Rate limiting or payment failure — 402 response requiring payment","Timeout fetching large or slow pages — may result in partial content"],"whenToPreferThis":"Choose this endpoint when you need to fetch and compress web content to fit within LLM token budgets, especially when you want BM25-ranked relevance filtering around a specific query. Prefer it over raw web scrapers when you need clean Markdown output or structured JSON extraction, or when minimizing downstream LLM costs is a priority. It is particularly useful when working with long documentation pages, pricing tables, or any HTML-heavy content that needs to be made agent-consumable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:38:06.472Z","isFirstParty":false,"canonicalSlug":"polymarket-odds-agentdiet-dev-web-distillation-with-bm25-budget-control-95f2916e"}