# Prompt Compress: BM25 Budget-Controlled Web Distillation

> Prompt Compress: BM25 Budget-Controlled Web Distillation is a paid API for AI agents from llms-generator.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown.

Fetches a URL or accepts raw HTML and distills it into compact agent-ready tokens using BM25 scoring with strict token budget control

## Facts

- Endpoint: POST https://llms-generator.agentdiet.dev/v1/prompt-compress?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Activations on Zero: 0
- Provider: llms-generator.agentdiet.dev
- Website: https://llms-generator.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/llms-generator-agentdiet-dev-prompt-compress-bm25-budget-controlled-e932158e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_MK-3qA3k8F3rEFwUwy6vq

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 llms-generator-agentdiet-dev-prompt-compress-bm25-budget-controlled-e932158e -d '<json body>'
```

Example prompt: Distill https://stripe.com/docs/payments into a focused excerpt about payment intents using BM25 budget mode, keeping it under 500 tokens.

## When to prefer this

Choose this endpoint when you need fine-grained control over token budgets and want BM25-based relevance filtering to extract only the most query-relevant content from a page. It is superior to a plain URL-to-markdown distiller when you have a specific focus query and a hard token limit, or when you want structured/skeleton output rather than raw markdown. Particularly useful for agentic pipelines where context window management is critical and LLM cost savings need to be tracked.

## Known failure modes

- Missing or invalid URL returns a validation error
- URL fetch fails due to network error or blocked access
- BM25 budget mode without a query string may produce degraded relevance ranking
- max_tokens set below minimum of 20 causes a schema validation error
- Payment failure via x402 blocks execution
- Raw HTML that is malformed or empty may return empty distilled output

## How this service works

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

## Output

Returns a distilled payload (markdown text, structured JSON tables/metadata, skeleton outline, or BM25-ranked excerpt) along with an ROI proof object showing raw token count, distilled token count, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and a cache status 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/llms-generator-agentdiet-dev-prompt-compress-bm25-budget-controlled-e932158e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from llms-generator.agentdiet.dev](https://www.zero.xyz/host/llms-generator.agentdiet.dev/llms.txt)
