# HTML to Markdown Token Compressor

> HTML to Markdown Token Compressor is a paid API for AI agents from html2md-converter.onrender.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-14).

Converts raw HTML strings to Markdown and reports token reduction metrics for AI agent context optimization

## Facts

- Endpoint: POST https://html2md-converter.onrender.com/v1/markdown/convert
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/html-to-markdown-token-compressor-7732e8bd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7HQjIXyKTNyI0TvVwJr7e

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 html-to-markdown-token-compressor-7732e8bd -d '<json body>'
```

Example prompt: Convert this raw HTML into Markdown and tell me how many tokens I'm saving — I want to compress it before feeding it into my LLM pipeline: <html><body><h1>Hello World</h1><p>This is a test page.</p></body></html>

## When to prefer this

Choose this endpoint when an AI agent pipeline needs to convert raw HTML to Markdown specifically to reduce token consumption before passing content to an LLM. It is ideal for RAG preprocessing, web scraping pipelines, and any workflow where minimizing context window usage from HTML sources is a priority. The built-in token metrics make it easy to measure and validate compression gains without a separate counting step.

## Known failure modes

- Missing or empty 'html' field returns a validation error
- Malformed or extremely large HTML may cause timeout or processing failure
- Non-HTML input (e.g. plain text or JSON) may produce poorly structured Markdown
- Service unavailability on the hosted render.com instance returns 503

## How this service works

Convert raw HTML into clean Markdown for LLM and AI-agent context windows. Removes scripts, styles, navigation, headers, footers, and optionally images or links, then returns measured token-reduction metrics. The caller supplies HTML directly; this service does not fetch URLs.

## Output

Returns a JSON object containing the converted Markdown string and a metrics object with input token count, output token count, and percentage token reduction achieved by the conversion.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "html": {
   "type": "string",
   "maxLength": 10000000,
   "minLength": 1,
   "description": "Raw HTML supplied directly by the caller. URLs are not fetched."
  },
  "options": {
   "type": "object",
   "properties": {
    "stripLinks": {
     "type": "boolean",
     "default": false,
     "description": "Preserve link text while removing destination URLs."
    },
    "stripImages": {
     "type": "boolean",
     "default": false,
     "description": "Remove image elements before Markdown conversion."
    }
   },
   "additionalProperties": false
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "metrics": {
   "input": {
    "bytes": 105,
    "chars": 105,
    "tokens": 32
   },
   "output": {
    "bytes": 30,
    "chars": 30,
    "tokens": 7
   },
   "savings": {
    "tokensSaved": 25,
    "estimatedTokenRatio": "4.6x",
    "percentageReduction": "78.13%"
   }
  },
  "markdown": "# Hello Agent\n\nUseful content."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/html-to-markdown-token-compressor-7732e8bd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from html2md-converter.onrender.com](https://www.zero.xyz/host/html2md-converter.onrender.com/llms.txt)
