# Web URL to Agent-Ready Token Distiller (RAG Token Diet)

> Web URL to Agent-Ready Token Distiller (RAG Token Diet) is a paid API for AI agents from json-repair.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-22).

Fetches and compresses a URL or raw HTML into compact, token-efficient content using BM25-based budget control and multiple extraction modes

## Facts

- Endpoint: GET https://json-repair.agentdiet.dev/v1/rag-token-diet?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Provider: json-repair.agentdiet.dev
- Website: https://json-repair.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/json-repair-agentdiet-dev-web-url-to-agent-ready-token-distiller-rag-adf034f6
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_yvE07cdyeJapqOn4RHSaw

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 json-repair-agentdiet-dev-web-url-to-agent-ready-token-distiller-rag-adf034f6
```

Example prompt: Fetch the page at https://stripe.com/docs/payments and distill it into markdown, keeping it under 800 tokens focused on the topic of payment intents.

## When to prefer this

Choose this endpoint when you need to feed live web content into an LLM or RAG pipeline and want to minimize token usage and cost. It is ideal when you have a URL (or raw HTML) and need to control output length precisely via BM25 budget mode, or when you want structured extraction modes (markdown, structured, skeleton) rather than raw scraping. Prefer it over generic web scrapers when token economy and LLM-readiness are primary concerns.

## Known failure modes

- URL is unreachable or returns non-200 HTTP status — endpoint may return an error status
- URL content is too large and cannot be fetched within service limits
- mode=budget requires a query parameter — missing query may cause degraded or default behavior
- max_tokens below minimum of 20 returns a validation error
- Raw HTML input too large may exceed processing limits
- Payment not processed (x402) results in 402 response blocking the call

## How this service works

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

## Output

Returns a JSON object with: distilled content (Markdown, structured JSON, skeleton outline, or BM25-focused excerpt) under the 'data' key; ROI proof metrics including raw_tokens, distilled_tokens, tokens_saved, compression_ratio_pct, and llm_cost_saved_usd; cache status (HIT/MISS); billing info; and an overall status field.

## 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/json-repair-agentdiet-dev-web-url-to-agent-ready-token-distiller-rag-adf034f6/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from json-repair.agentdiet.dev](https://www.zero.xyz/host/json-repair.agentdiet.dev/llms.txt)
