# AgentDiet Web Distiller with BM25 Budget Control

> AgentDiet Web Distiller with BM25 Budget Control is a paid API for AI agents from shopify-spy.agentdiet.dev, paid per call via MPP, $0.001/call, status unknown (last checked 2026-10-23).

Fetches and distills a URL or raw HTML into compact agent-ready tokens using BM25-ranked budget control with configurable token ceiling

## Facts

- Endpoint: POST https://shopify-spy.agentdiet.dev/api/diet?utm_source=zero.xyz
- Price: $0.001/call
- Payment: MPP
- Status: unknown
- Last checked: 2026-10-23
- Activations on Zero: 0
- Provider: shopify-spy.agentdiet.dev
- Website: https://shopify-spy.agentdiet.dev
- Canonical page: https://www.zero.xyz/c/shopify-spy-agentdiet-dev-agentdiet-web-distiller-with-bm25-budget-d7b1f0ab
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_T-iqdNrepSaQwK0d_d0iR

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 shopify-spy-agentdiet-dev-agentdiet-web-distiller-with-bm25-budget-d7b1f0ab -d '<json body>'
```

Example prompt: Fetch the page at https://stripe.com/docs/payments and distill it into budget mode with a 500-token ceiling, focusing the BM25 query on 'payment intent API' so I only get the most relevant content.

## When to prefer this

Choose this endpoint when you need to extract actionable content from a webpage within a strict token budget, especially when using BM25 relevance ranking to focus on query-specific sections. It is superior to generic scrapers when token cost matters, when you need structured output formats (markdown, tables, skeleton), or when you want quantified ROI proof of compression. Prefer it over basic distill endpoints when the target page is long and you need only the most relevant fragment.

## Known failure modes

- URL is unreachable or returns non-200 status — endpoint may return an error status
- Raw HTML string is malformed or empty — distillation may fail or return minimal output
- Token budget (max_tokens) set too low — may return truncated or empty excerpt
- BM25 query provided without mode=budget — query may be ignored
- Payment fails or wallet has insufficient USDC — 402 response blocks execution
- Idempotency-Key collision — may return a cached prior response unexpectedly

## How this service works

Distill a URL or raw HTML payload with BM25 budget control (Live x402 v2, IETF MPP & MCP endpoint at https://shopify-spy.agentdiet.dev/api/diet)

## Output

Returns a JSON object containing the distilled content (markdown, structured tables/metadata, skeleton outline, or BM25-ranked excerpt), execution status, cache hit/miss info, billing details, and an roi_proof object showing raw vs distilled token counts, tokens saved, compression ratio percentage, estimated LLM cost saved in USD, and the ROI multiplier.

## 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/shopify-spy-agentdiet-dev-agentdiet-web-distiller-with-bm25-budget-d7b1f0ab/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from shopify-spy.agentdiet.dev](https://www.zero.xyz/host/shopify-spy.agentdiet.dev/llms.txt)
