# HTML/URL to Markdown Distiller with BM25 Budget Control

> HTML/URL to Markdown Distiller with BM25 Budget Control is a paid API for AI agents from token-intel.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-21).

Fetches a URL or accepts raw HTML and distills it into compact, agent-ready Markdown or structured output with token-budget enforcement via BM25 ranking

## Facts

- Endpoint: GET https://token-intel.agentdiet.dev/v1/html-to-markdown?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: token-intel.agentdiet.dev
- Website: https://token-intel.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/token-intel-agentdiet-dev-html-url-to-markdown-distiller-with-bm25-75478cb4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_70ajvzfbfnr-c-Sh-wzL8

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 token-intel-agentdiet-dev-html-url-to-markdown-distiller-with-bm25-75478cb4
```

Example prompt: Fetch the page at https://docs.stripe.com/payments and distill it into compact markdown using budget mode, focused on 'payment intents', capped at 500 tokens.

## When to prefer this

Choose this endpoint when your agent needs to fetch live web content and must stay within a strict token budget before passing content to an LLM. It is especially valuable when the target page is large and you want BM25-ranked relevance filtering, or when you need structured tables/metadata extracted from HTML rather than raw text. Prefer it over generic web scrapers when token cost savings and ROI measurement matter to your pipeline.

## Known failure modes

- Invalid or unreachable URL returns an error status
- max_tokens below minimum of 20 triggers validation error
- mode=budget without a query may return unranked content
- Raw HTML injection via the html field may produce unexpected output if malformed
- Payment failure via x402 returns HTTP 402 with no content
- Rate limits or bot-blocking on target URLs may return empty or partial content

## How this service works

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

## Output

Returns a JSON object with distilled content (Markdown text, structured JSON tables/metadata, page skeleton, or BM25-ranked budget excerpt), plus an ROI proof block showing raw vs distilled token counts, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and a cache hit/miss indicator.

## 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/token-intel-agentdiet-dev-html-url-to-markdown-distiller-with-bm25-75478cb4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from token-intel.agentdiet.dev](https://www.zero.xyz/host/token-intel.agentdiet.dev/llms.txt)
