# Web URL Context Compressor

> Web URL Context Compressor is a paid API for AI agents from preflight.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-21).

Fetches a web page and distills it into compact, token-efficient agent-ready content using multiple extraction modes (markdown, structured, skeleton, or BM25-budget)

## Facts

- Endpoint: GET https://preflight.agentdiet.dev/v1/context-compress?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Provider: preflight.agentdiet.dev
- Website: https://preflight.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/preflight-agentdiet-dev-web-url-context-compressor-edac279c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_3DUFlv0j3RMQPxCeoikoR

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 preflight-agentdiet-dev-web-url-context-compressor-edac279c
```

Example prompt: Distill https://stripe.com/docs/payments into compact markdown so I can fit it in my context window — use budget mode focused on 'webhooks' and keep it under 500 tokens.

## When to prefer this

Choose this endpoint when an AI agent needs to ingest web page content but must stay within a token budget or minimize LLM inference costs. It is especially useful when the raw HTML or full markdown of a page would be too large to fit in a context window. Prefer it over raw web scraping tools when you need token-count guarantees (budget mode with max_tokens), keyword-focused excerpts (BM25 mode), or clean structured tables from a page. Also prefer it when cost efficiency matters — the roi_proof field lets agents verify the compression ROI before deciding how to use the output.

## Known failure modes

- URL is unreachable or returns a non-200 response — endpoint may return an error status
- URL content is empty or has no extractable text — distilled output may be minimal
- BM25 query provided without mode=budget — query parameter ignored silently
- max_tokens too low to fit any meaningful content — may return truncated or empty excerpt
- Payment failure via x402 — request not fulfilled if USDC payment not completed
- Invalid URL format — validation error on required url parameter

## How this service works

Distill a web URL into compact agent-ready tokens (Live x402 v2, IETF MPP & MCP endpoint at https://preflight.agentdiet.dev/v1/context-compress)

## Output

Returns a data object containing the distilled content (markdown, structured JSON, skeleton outline, or BM25 excerpt depending on mode), plus an roi_proof block showing raw vs distilled token counts, tokens saved, compression ratio percentage, and estimated LLM cost saved in USD. Also includes cache hit/miss status and billing details.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "url"
 ],
 "properties": {
  "url": {
   "type": "string",
   "minLength": 1,
   "description": "Target webpage URL to distill (or builtin://stripe-docs)"
  },
  "mode": {
   "enum": [
    "markdown",
    "structured",
    "skeleton",
    "budget"
   ],
   "type": "string",
   "default": "markdown",
   "description": "Extraction mode: markdown, structured, skeleton, or budget"
  },
  "query": {
   "type": "string",
   "description": "BM25 focus query when mode=budget"
  },
  "max_tokens": {
   "type": "integer",
   "minimum": 20,
   "description": "Strict token 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/preflight-agentdiet-dev-web-url-context-compressor-edac279c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from preflight.agentdiet.dev](https://www.zero.xyz/host/preflight.agentdiet.dev/llms.txt)
