{"uid":"cap_2G6z8lW2qSeHLLgkd26Vl","slug":"x402broker-com-token-optimizer-agentdiet-html-distillation-bb831a37","name":"x402broker.com Token Optimizer (AgentDiet HTML Distillation)","description":"Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://x402broker.com/v1/token-optimizer)","url":"https://x402broker.com/v1/token-optimizer?utm_source=zero.xyz","method":"GET","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":["x402"],"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":"unknown","protocol":"x402","network":"base","amountUsd":null,"per":"call","confidence":"unknown"},{"kind":"static","protocol":"mpp","network":"tempo","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_udho-vh4pU0cx5DYKdXQ9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null},{"uid":"pm_8Vx7RsXD8VEmxO2a7qNel","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Strips 85-97% of HTML token bloat from a given URL, returning a semantically distilled, token-efficient version of the page content","exampleAgentPrompt":"Fetch the page at https://example.com/article and strip all the HTML bloat — I just need the clean semantic content so I can pass it to my model without burning through the context window.","exampleUseCases":[{"title":"Preprocess news article for LLM summarization","prompt":"Grab https://www.nytimes.com/2024/01/15/tech/ai-article.html and strip out all the ads, nav menus, and HTML junk — just give me the core article text so I can summarize it without wasting tokens."},{"title":"Compress documentation page for agent RAG pipeline","prompt":"I need to index https://docs.langchain.com/docs/concepts into my RAG system, but the raw HTML is way too bloated — can you distill it down to just the meaningful content?"},{"title":"Token-efficient web research for product comparison","prompt":"Pull the product page at https://www.amazon.com/dp/B09XYZ123 and give me a token-optimized version of the content — I want to compare it with other products without hitting context limits."}],"resultDescription":"A semantically distilled, token-efficient version of the target webpage, with 85-97% of HTML boilerplate, ads, navigation, and structural noise removed, leaving only the core textual content. Likely returned as cleaned markdown or plain text suitable for direct ingestion into an LLM context window.","failureModes":["URL is unreachable or returns a non-200 status — endpoint may error or return empty content","JavaScript-heavy SPAs may not render fully, resulting in incomplete distillation","Paywalled or auth-gated pages return only login prompts rather than content","Very large pages may time out or return partial results","Malformed or missing 'url' query parameter causes a 400-level error","Payment not fulfilled via x402 protocol results in 402 Payment Required response"],"whenToPreferThis":"Choose this endpoint when you need to pass web page content to an LLM and want to minimize token consumption and cost — especially when raw HTML would be too large or noisy for a context window. Ideal for agent pipelines doing web research, RAG ingestion, or content summarization where token efficiency is critical. Prefer over generic scrapers when semantic preservation (not just raw text) is important.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-20T12:48:05.656Z","isFirstParty":false,"canonicalSlug":"x402broker-com-token-optimizer-agentdiet-html-distillation-bb831a37"}