{"uid":"cap_u9VBSCoKZAlx6qe6eFPqV","slug":"alpha-stream-agentdiet-dev-agentdiet-context-diet-bm25-budget-7f452046","name":"AgentDiet Context Diet — 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://alpha-stream.agentdiet.dev/v1/context-diet)","url":"https://alpha-stream.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_zC2rlY4Cd692Op_F9ZJKs","protocol":"mpp","methodType":"crypto","chain":"tempo","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":"alpha-stream.agentdiet.dev","brandSlug":"alpha-stream-agentdiet-dev-mpp","brandBaseUrl":"https://alpha-stream.agentdiet.dev","brandDocsUrl":null,"whatItDoes":"Fetches a URL or processes raw HTML and distills it into compact, agent-ready tokens using BM25-ranked budget control to maximize information density within a token ceiling.","exampleAgentPrompt":"Distill https://stripe.com/docs/payments/checkout into compact markdown using budget mode, focused on the query 'payment intent flow', with a max of 500 tokens.","exampleUseCases":[{"title":"Fit documentation into LLM context window","prompt":"Take the content at https://docs.anthropic.com/claude/reference/getting-started-with-the-api and distill it into budget mode focused on 'rate limits and authentication', keeping it under 800 tokens — I need to feed it to another model without blowing the context window."},{"title":"Extract relevant section from long article","prompt":"Grab https://en.wikipedia.org/wiki/Large_language_model and give me a BM25 budget excerpt focused on the query 'training data and compute scaling', max 400 tokens, in markdown format."},{"title":"Compress raw HTML for agent pipeline","prompt":"I have a raw HTML blob from a scraped pricing page — distill it into a structured mode so I can pull out the pricing table without wasting tokens on nav bars and footers."}],"resultDescription":"Returns a JSON object with a 'data' field containing the distilled content (Markdown, structured JSON, skeleton outline, or BM25 excerpt depending on mode), plus an 'roi_proof' object showing raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, roi_multiplier, and llm_cost_saved_usd. Also includes cache hit/miss status and billing details.","failureModes":["URL is unreachable or returns a non-200 status — endpoint may return an error status","HTML payload is malformed or empty — distillation returns minimal or empty data field","max_tokens set too low (below 20) — rejected by schema validation","mode=budget used without a query parameter — BM25 ranking has no focus signal","Rate limiting or payment failure via x402 — 402 response with payment required details","Idempotency-Key collision across different request bodies — may return cached result unexpectedly"],"whenToPreferThis":"Choose this endpoint when you need to feed web content to an LLM but want to minimize token consumption and cost, especially when you have a strict context window budget or a specific query focus. It excels over generic scrapers when you need BM25-ranked relevance filtering (budget mode) rather than full-page extraction. Prefer it over raw fetch-and-summarize approaches when ROI metrics (tokens saved, compression ratio) matter for agent cost accounting. Best for agentic pipelines that process many URLs and need predictable, bounded token output.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T06:37:45.060Z","isFirstParty":false,"canonicalSlug":"alpha-stream-agentdiet-dev-agentdiet-context-diet-bm25-budget-7f452046"}