# Context Diet – Web Distillation with BM25 Budget Control

> Context Diet – Web Distillation with BM25 Budget Control is a paid API for AI agents from x402broker.com, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-23).

Fetches a URL or accepts raw HTML and distills it into compact markdown, structured JSON, skeleton outline, or a BM25-focused excerpt under a strict token budget

## Facts

- Endpoint: POST https://x402broker.com/v1/context-diet?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-23
- Activations on Zero: 0
- Provider: x402broker.com
- Website: https://x402broker.com
- Canonical page: https://www.zero.xyz/c/x402broker-com-context-diet-web-distillation-with-bm25-budget-control-fd24d772
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zMeBzueJ6ePDHAXWVMJuE

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402broker-com-context-diet-web-distillation-with-bm25-budget-control-fd24d772 -d '<json body>'
```

Example prompt: Fetch https://stripe.com/docs/payments and distill it down to clean markdown, keeping it under 800 tokens and focused on the query 'payment intents setup'.

## When to prefer this

Choose this endpoint when an AI agent needs to ingest a webpage or HTML document but the raw content would exceed LLM context limits or waste tokens on boilerplate. It is especially valuable in RAG pipelines, research agents, and MCP tool chains where token efficiency directly reduces LLM costs. The BM25 budget mode is uniquely suited for focused extraction when only a fraction of a page is relevant to a specific query. Prefer this over generic scrapers when you need built-in token budgeting, ROI tracking, and multiple distillation modes in one call.

## Known failure modes

- URL unreachable or returns non-200 — endpoint may return an error status
- HTML payload too large or malformed — may fail parsing
- max_tokens set below minimum of 20 — schema validation error
- BM25 query missing when mode=budget — may return unfiltered or error
- Invalid mode enum value — rejected by schema validation
- Page behind authentication or bot protection — content not accessible
- Rate limiting or payment failure via x402 — 402 response requiring payment

## How this service works

Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://x402broker.com/v1/context-diet)

## Output

Returns a JSON object containing: a 'data' field with the distilled content (markdown string, structured tables/metadata, skeleton outline, or BM25 excerpt depending on mode); an 'roi_proof' object showing raw token count, distilled token count, tokens saved, compression ratio %, ROI multiplier, and estimated LLM cost saved in USD; optional cache metadata (HIT/MISS, latency); and billing info. The distilled content is the primary payload an agent would pass downstream.

## Request schema (JSON Schema)

```json
{
 "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"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402broker-com-context-diet-web-distillation-with-bm25-budget-control-fd24d772/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402broker.com](https://www.zero.xyz/host/x402broker.com/llms.txt)
