# RAG-Diet: URL & HTML Distiller with BM25 Budget Control

> RAG-Diet: URL & HTML Distiller with BM25 Budget Control is a paid API for AI agents from mesh.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-23).

Fetches and distills any URL or raw HTML into compact Markdown, structured JSON, skeleton outline, or BM25-focused token-budget excerpt for LLM consumption

## Facts

- Endpoint: POST https://mesh.agentdiet.dev/v1/rag-diet?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-23
- Activations on Zero: 0
- Provider: mesh.agentdiet.dev
- Website: https://mesh.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/mesh-agentdiet-dev-rag-diet-url-html-distiller-with-bm25-budget-control-f6f8ad99
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_lPzbz_BAyunXvrdBdqFNq

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 mesh-agentdiet-dev-rag-diet-url-html-distiller-with-bm25-budget-control-f6f8ad99 -d '<json body>'
```

Example prompt: Distill the content at https://stripe.com/docs/payments into markdown mode and keep it under 800 tokens, focusing on 'payment intents setup' so I can feed just the relevant bits to my LLM without blowing my context window.

## When to prefer this

Choose this endpoint when you need to feed web content into an LLM efficiently and want provable token savings with compression metrics. It is especially valuable in RAG pipelines where context budget matters, when you need BM25-ranked relevance filtering within a strict token ceiling, or when you want structured JSON tables/metadata extracted from HTML rather than raw text dumps. Prefer it over generic web scrapers when token economy and LLM cost reduction are primary concerns.

## Known failure modes

- URL is unreachable or returns non-200 — distillation fails with error status
- Raw HTML is malformed or empty — returns empty or minimal distillation
- mode=budget used without a query field — BM25 ranking cannot be performed
- max_tokens set below minimum of 20 — validation error
- Target page is heavily JavaScript-rendered and server-side fetch returns shell HTML — poor distillation quality
- Network timeout on slow or large pages — partial or failed response

## How this service works

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

## Output

Returns a JSON object containing: distilled content (Markdown string, structured JSON tables/metadata, skeleton outline, or BM25-focused excerpt) in `data`; ROI proof metrics including raw token count, distilled token count, tokens saved, compression ratio %, and estimated LLM cost saved in USD; optional cache hit/miss status with latency; and billing details including fee charged ($0.001 USD per call).

## 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/mesh-agentdiet-dev-rag-diet-url-html-distiller-with-bm25-budget-control-f6f8ad99/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from mesh.agentdiet.dev](https://www.zero.xyz/host/mesh.agentdiet.dev/llms.txt)
