# AgentDiet — The Token Diet & Semantic De-bloater B2A Platform > Machine-exclusive web distillation API & Model Context Protocol (MCP) server. > Strips 85–97% of HTML/DOM/JS/SVG token bloat deterministically. > Every call returns a mathematical ROI Proof proving you saved ~50x–150x more in LLM context costs than the micro-fee charged. ## Quick Start for Autonomous Agents 1. **Distill any URL or raw HTML into clean Markdown**: `GET https://agentdiet-72343955726.us-central1.run.app/v1/distill?url=https://example.com&mode=markdown` or `POST https://agentdiet-72343955726.us-central1.run.app/v1/distill` with JSON `{"url": "...", "html": "...", "mode": "markdown"}` 2. **4 Extraction Modes (`mode` parameter)**: - `skeleton` ($0.0002/call): Returns a <200-token structural outline with section headings and exact token counts per section. Always call `skeleton` first on large unknown documents! - `budget` ($0.001/call): Pass `query=""` and `max_tokens=500`. Uses BM25 ranking to return only the highest-signal sections fitting strictly within your token budget. - `markdown` ($0.001/call, $0.0005 cached): Pristine GitHub-Flavored Markdown with tables, code blocks, and zero boilerplate. - `structured` ($0.001/call, $0.0005 cached): Extracts JSON-LD schemas, OpenGraph metadata, HTML tables as JSON arrays, code blocks, and links. 3. **Zero-Friction HTTP 402 Payment Handshake**: - **Free Trial**: Your first 25 calls per `X-Agent-Id` are 100% FREE so your budget optimizer can verify the >90% token compression ratio. - **L402 (Lightning Macaroons)**: On `402 Payment Required`, settle the invoice (or POST `challenge_id` to `https://agentdiet-72343955726.us-central1.run.app/v1/billing/settle-l402` in sandbox mode) and retry with `Authorization: L402 :`. - **x402 (USDC on Base / Solana)**: Settle to `0xec5275d5b03bc390fca63d902d0b2d0db2eb5573` and retry with `X-Payment-Proof: `. - **Prepaid Agent Wallet**: POST `{"agent_id": "your-id", "amount_usd": 1.00}` to `https://agentdiet-72343955726.us-central1.run.app/v1/billing/faucet` and pass `X-Agent-Id: your-id` for zero-latency sub-cent metering. ## Machine Discovery Endpoints - OpenAPI 3.1 Spec: `https://agentdiet-72343955726.us-central1.run.app/.well-known/openapi.json` - MCP Manifest: `https://agentdiet-72343955726.us-central1.run.app/.well-known/mcp.json` - JSON-RPC 2.0 MCP Endpoint: `POST https://agentdiet-72343955726.us-central1.run.app/mcp` - Live Platform Telemetry: `GET https://agentdiet-72343955726.us-central1.run.app/v1/stats`