{"uid":"cap_YkxKxGt-dX9ot17JhL-Lk","slug":"defi-yield-agentdiet-dev-spa-markdown-reader-with-bm25-budget-control-895d8f8f","name":"SPA Markdown Reader 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://defi-yield.agentdiet.dev/v1/spa-markdown-reader)","url":"https://defi-yield.agentdiet.dev/v1/spa-markdown-reader?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_T2mbFfgZKK_b1evcR2IkP","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"defi-yield.agentdiet.dev","brandSlug":"defi-yield-agentdiet-dev-mpp","brandBaseUrl":"https://defi-yield.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or processes raw HTML and distills it into Markdown, structured JSON, skeleton outline, or a BM25-focused token-budgeted excerpt","exampleAgentPrompt":"Fetch https://docs.uniswap.org/contracts/v3/reference/core/UniswapV3Pool and distill it into clean markdown using budget mode focused on 'liquidity pool functions', keeping the output under 2000 tokens.","exampleUseCases":[{"title":"Research web page for LLM pipeline","prompt":"Grab https://stripe.com/docs/api/charges and distill it into structured markdown so I can feed it into my LLM without blowing my token budget — focus the BM25 query on 'charge creation parameters' and cap it at 1500 tokens."},{"title":"Extract competitor pricing from a live site","prompt":"Fetch https://www.notion.so/pricing and distill the page into a skeleton outline so I can quickly see all the pricing tiers and features without wading through the full HTML."},{"title":"Compress raw HTML snippet for agent context","prompt":"I have this raw HTML from a DeFi protocol page — can you distill it directly into clean markdown in structured mode so I can parse the yield tables and metadata without hitting my context limit?"}],"resultDescription":"Returns a JSON object containing: the distilled content (Markdown text, structured JSON tables/metadata, skeleton outline, or BM25-focused excerpt) under 'data'; an 'roi_proof' object with raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, roi_multiplier, and llm_cost_saved_usd; optional cache hit/miss info; billing details; and a status field indicating success.","failureModes":["Invalid or unreachable URL returns an error status and empty data","Token budget too low (below 20) triggers a validation error","BM25 mode without a query string may return unfiltered or empty results","Raw HTML field ignored if URL is also provided (URL takes precedence)","SPA pages requiring JavaScript rendering may return incomplete content","Rate limiting or payment failure returns HTTP 402"],"whenToPreferThis":"Choose this endpoint when you need to convert live web pages or raw HTML into compact, LLM-ready content while controlling token cost. It is especially valuable when fetching large documentation pages, DeFi protocol sites, or SPAs where you want to limit the output to a specific token budget and optionally focus on a BM25 query. Prefer it over generic scrapers when ROI tracking (tokens saved, compression ratio) and multiple distillation modes (markdown, structured, skeleton, budget) are important for your agent pipeline.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:40:19.833Z","isFirstParty":false,"canonicalSlug":"defi-yield-agentdiet-dev-spa-markdown-reader-with-bm25-budget-control-895d8f8f"}