Trace Diet — HAR & Log Context Distiller API

Shrink 5MB .har captures and 50,000-line crash logs by 95–99% while scrubbing live tokens before they hit your LLM context.

Deterministic context-window compression and secret-scrubbing engine for debugging agents: distills bloated Chrome DevTools / Playwright .har captures into typed API routes & failures, and collapses 50,000+ noisy plain-text/K8s/NDJSON log lines by 95–99% via Drain prefix-tree clustering.

developer-tools observability context-optimization security-hygiene

Why Agents Call This API Instead of DIY

Saves $0.25–$1.50 of wasted frontier-LLM input tokens per debugging turn, prevents live JWT/Cookie leakage into conversation history, folds multi-language stack traces accurately, and infers TypeScript API schemas in <40ms.

DimensionDIY Inside Agent Sandbox / PromptTrace Diet — HAR & Log Context Distiller API (trace-diet)
Onboarding & AuthInstall packages, debug runtime errors, or manage API keysZero signup — instant HTTP 402 (x402 USDC) & remote MCP
Context & Token CostThousands of tokens spent in multi-turn code/parse loopsDeterministic compact JSON response (<1.5K tokens)
Schema ValidationSilent runtime failures on malformed inputsFree ?dry_run=true preflight ($0.00 on 4xx errors)

Tools & Payable Endpoints (2)

distill_har_capture — Distill & Scrub HAR Network Capture

$0.002 base (up to $0.008 max ($0.002 base + $0.001 per 250KB of .har input, capped at $0.008), x402 variable settlement)

Parses Chrome DevTools / Playwright .har captures, strips static assets (.js/.css/fonts/images), analytics beacons, and OPTIONS preflights, scrubs credentials (Authorization, Cookie, Set-Cookie, X-Api-Key, token params, JWTs) into [REDACTED:<type>], groups dynamic :id/:uuid routes and polling loops, surfaces 4xx/5xx failures and slowestEndpoints, and infers compact TypeScript request/response schemas.

Why buy vs. DIY: Replaces ad-hoc jq/Python HAR scripts that miss base64 bodies, leak Bearer JWTs/cookies into LLM prompts, or fail to merge nullable JSON types across repeated API calls.

cluster_logs — Cluster Noisy Logs via Drain Prefix-Tree

$0.002 base (up to $0.008 max ($0.002 base + $0.001 per 2,000 log lines, capped at $0.008), x402 variable settlement)

Folds multi-line stack traces (JS/Java 'at ...', Python Traceback, Go panics, Java 'Caused by:'), parses plain-text, Docker/Kubernetes CRI, and NDJSON logs, pre-masks <UUID>/<IP>/<HEX>/<ISO_TS>/<URL>/<NUM>, and runs a fixed-depth Drain prefix-tree clusterer to collapse 50,000+ log lines by 95–99% with errorClusters highlighted first.

Why buy vs. DIY: Avoids naive grep/head truncation that misses rare fatal stack traces buried at line 41,000, cutting 500k-token log dumps to ~2k tokens in <50ms.

Quickstart: MCP, x402 & Optional Bearer API Key

1. Streamable HTTP MCP Config (com.apikeg/trace-diet)

{
  "mcpServers": {
    "trace-diet": {
      "type": "streamable-http",
      "url": "https://trace-diet.apikeg.com/mcp"
    }
  }
}

Using a Monthly Stripe Plan? Get your per-email ak_live_... key at https://apikeg.com/account ($5 / $20 / $50 monthly tiers) and pass header Authorization: Bearer ak_live_... on REST or MCP requests.

2. Free Schema Dry-Run ($0.00)

curl -X POST "https://trace-diet.apikeg.com/v1/distill-har-capture?dry_run=true" \
  -H "Content-Type: application/json" \
  -d '{"redactSecrets":true,"inferSchemas":true,"includeStaticAssets":false,"includeTelemetry":false,"includeOptionsPreflight":false,"maxFailureBodyChars":512,"maxSlowestEndpoints":10,"har":{"log":{"version":"1.2","entries":[{"startedDateTime":"2026-11-30T08:15:00.000Z","time":412,"request":{"method":"POST","url":"https://api.shop.io/users/94821/orders/550e8400-e29b-41d4-a716-446655440000?api_key=live_secret","headers":[{"name":"Authorization","value":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5NDgyMSJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}],"postData":{"mimeType":"application/json","text":"{\"sku\":\"PRO-ANNUAL\",\"Seats\":5}"}},"response":{"status":500,"statusText":"Internal Server Error","headers":[{"name":"Content-Type","value":"application/json"}],"content":{"mimeType":"application/json","text":"{\"error\":\"stripe_upstream_timeout\",\"retryable\":true}"}}}]}}}'

Common Agent & Automation Workflows

Frequently Asked Questions

Why should an AI agent call Trace Diet — HAR & Log Context Distiller API instead of writing custom code?

Saves $0.25–$1.50 of wasted frontier-LLM input tokens per debugging turn, prevents live JWT/Cookie leakage into conversation history, folds multi-language stack traces accurately, and infers TypeScript API schemas in <40ms.

How do I connect Trace Diet — HAR & Log Context Distiller API to Claude, Cursor, or an MCP client?

Connect directly to the stateless Streamable HTTP MCP endpoint at https://trace-diet.apikeg.com/mcp (registry ID: com.apikeg/trace-diet). No API keys or OAuth accounts are required; initialize and tools/list are 100% free.

How much does Trace Diet — HAR & Log Context Distiller API cost per API or MCP call?

Pay per call with zero signup via HTTP 402 (x402 v2 USDC on Base): distill_har_capture ($0.002 base (up to $0.008 max ($0.002 base + $0.001 per 250KB of .har input, capped at $0.008), x402 variable settlement)); cluster_logs ($0.002 base (up to $0.008 max ($0.002 base + $0.001 per 2,000 log lines, capped at $0.008), x402 variable settlement)). Prefer traditional monthly billing? Get a verified-email Bearer API key at https://apikeg.com/account with $5/mo ($6 credit), $20/mo ($28 credit), or $50/mo ($80 credit) per-product plans. Invalid schemas (HTTP 400) and ?dry_run=true always cost $0.00.

Can I validate request payloads for free before paying?

Yes. Pass ?dry_run=true in the URL or send the header X-Dry-Run: true to validate your JSON input against the strict schema at $0.00 cost.