# Web Distillation with BM25 Budget Control

> Web Distillation with BM25 Budget Control is a paid API for AI agents from mcp-security.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-11-21).

Fetches and distills a URL or raw HTML into compact, token-efficient output with optional BM25-based budget-capped excerpting for LLM context optimization

## Facts

- Endpoint: POST https://mcp-security.agentdiet.dev/v1/prompt-compress?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-11-21
- Activations on Zero: 0
- Provider: mcp-security.agentdiet.dev
- Website: https://mcp-security.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/mcp-security-agentdiet-dev-web-distillation-with-bm25-budget-control-0f99109f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-jtwtZSMlvLZWRooVoVdB

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 mcp-security-agentdiet-dev-web-distillation-with-bm25-budget-control-0f99109f -d '<json body>'
```

Example prompt: Can you distill the content at https://stripe.com/docs/payments into compact markdown, using budget mode with a focus query of 'payment intents' and a max token limit of 500?

## When to prefer this

Choose this endpoint when you need to feed live web content into an LLM context window efficiently and cost-effectively, especially when pages are verbose and token budgets are tight. It is ideal over generic scrapers when you need BM25-ranked budget-capped excerpts aligned to a specific query, or when you want structured/skeleton output rather than raw HTML. Prefer it over raw fetch + parse pipelines when you want built-in ROI proof (tokens saved, cost saved) and multiple distillation modes in a single call.

## Known failure modes

- URL unreachable or returns non-200 — fetch fails, endpoint returns error status
- HTML payload too large — may exceed processing limits
- Invalid mode enum value — request rejected with validation error
- max_tokens below minimum of 20 — validation error
- BM25 query missing when mode=budget — may return unfiltered or error
- x402 payment failure — call blocked if payment not completed
- Cache miss on first call may add latency
- Idempotency-Key collision may return cached prior result unexpectedly

## How this service works

Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://mcp-security.agentdiet.dev/v1/prompt-compress)

## Output

Returns a distilled representation of the target URL or HTML in the chosen mode (Markdown, structured JSON, skeleton outline, or BM25 budget excerpt), along with an ROI proof object showing raw token count, distilled token count, tokens saved, compression ratio percentage, estimated LLM cost saved, and an optional billing and cache status block.

## 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/mcp-security-agentdiet-dev-web-distillation-with-bm25-budget-control-0f99109f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from mcp-security.agentdiet.dev](https://www.zero.xyz/host/mcp-security.agentdiet.dev/llms.txt)
