# PrepLayer.ai — full reference Everything an agent needs to call PrepLayer in one fetch. Deterministic text preprocessing, paid per call with x402 (USDC). Base URL: https://api.maximusmediahouse.com ## Protocol 1. A `POST` to the tool path with no payment header returns `402`. 2. The body is `402` + a `PAYMENT-REQUIRED` header (base64 JSON `{x402Version, accepts[]}`). 3. `accepts[0]` names the requirement (USDC, scheme `exact`) settled via a facilitator. 4. A paid retry carries the base64 `paymentPayload` in the `X-Payment` header. 5. A successful call returns `200` JSON: the tool result plus a `payment_receipt` object. Treasury `0x8cb59b1bffb39c130ab85a8177e93eae9ddbaf10`. Networks Base `eip155:8453`, Solana `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, Polygon `eip155:137`, Arbitrum `eip155:42161`. Polygon and Arbitrum price 1.2x Base. Every endpoint below is deterministic — no model is called underneath. ## normalize — $0.002 Unicode NFKC normalization, zero-width and bidi control stripping, smart-quote and dash folding to ASCII, whitespace collapsing, optional case folding. Returns a stable content hash for exact-equality comparison. POST `/v1/normalize` ```json { "text": "Hello, world—", "fold_case": true, "strip_invisible": true, "fold_width": true, "collapse_whitespace": true } ``` All flags except `text` default to `true`. `text` accepts 1-100000 characters. ## validate — $0.002 Validate and canonicalize a single identifier. Returns `{valid, canonical, fingerprint}`. POST `/v1/validate` ```json { "kind": "email", "value": "User@Example.COM" } ``` `kind` is one of: `email`, `url`, `phone` (E.164), `iban` (mod-97), `card` (Luhn), `uuid`, `sha256`, `gitsha`, `evm` (EIP-55 checksum), `domain`. ## slugify — $0.002 URL-safe slug generation with optional transliteration of non-ASCII characters. POST `/v1/slugify` ```json { "text": "Café Déjà Vu — Episode 1", "max_length": 80, "separator": "-", "transliterate": true } ``` ## hash — $0.002 Content hash for deduplication and integrity checks. POST `/v1/hash` ```json { "text": "some content", "algo": "sha256" } ``` `algo` defaults to `sha256`; `sha512` also supported. ## classify — $0.003 Language and content-type classification with a confidence threshold. POST `/v1/classify` ```json { "text": "…", "threshold": 0.5 } ``` ## validate_json — $0.003 Validate and canonicalize a JSON document against an optional JSON Schema. POST `/v1/validate_json` ```json { "json": { "a": 1 }, "schema": { "type": "object" } } ``` `schema` is optional; without it the call only checks well-formedness and canonical key order. ## extract — $0.005 Typed field extraction. Returns values with span offsets, so each match is citable. POST `/v1/extract` ```json { "text": "…", "types": ["email", "url", "date", "money", "key", "person"] } ``` ## redact — $0.005 PII redaction by class, returning the redacted text plus the spans removed. POST `/v1/redact` ```json { "text": "…", "classes": ["email", "phone", "ssn", "card", "iban"] } ``` ## diff — $0.005 Deterministic line and word diff between two documents. POST `/v1/diff` ```json { "a": "first", "b": "second", "format": "unified", "context": 3 } ``` `format` accepts `unified` or `inline`; `context` is lines of surrounding context. ## chunk — $0.005 Token-aware chunking with overlap and a strategy selector. POST `/v1/chunk` ```json { "text": "…", "size": 512, "overlap": 64, "strategy": "recursive" } ``` ## extract_custom — $0.005 Extract arbitrary named fields that you define inline. POST `/v1/extract_custom` ```json { "text": "…", "fields": [ { "name": "ticket_id", "type": "string", "pattern": "TKT-[0-9]+" }, { "name": "amount", "type": "money" } ] } ``` ## dedupe — $0.01 Near-duplicate detection across a batch of up to 200 documents. Exact Jaccard similarity over word-3-shingle sets decides duplication; each document also gets a compact 64-bit SimHash content fingerprint. POST `/v1/dedupe` ```json { "documents": [{ "id": "a", "text": "…" }, { "id": "b", "text": "…" }], "threshold": 0.8 } ``` ## batch ladder — $0.02 / 10, $0.075 / 50, $0.100 / 100 Run up to 10, 50 or 100 of the tools above in a single paid call. The per-call price falls as the bundle grows: $0.0020 (10), $0.0015 (50), $0.0010 (100). POST `/v1/batch` ```json { "requests": [ { "endpoint": "normalize", "input": { "text": "Hello" } }, { "endpoint": "hash", "input": { "text": "Hello" } } ] } ``` ## Recurring tier — prepaid call balance `POST /v1/subscription` — one settled $1.00 x402 payment credits 1,000 prepaid calls (=$0.0010 per call). The balance is drawn down across sessions on cheap deterministic routes (≤ $0.01) with no payment header. Query remaining capacity at `GET /v1/subscription/balance?wallet=0x…`. This prepaid pack does not auto-renew: it is a one-time top-up, the spend stops when the balance reaches zero, and you top up again only when you choose to. When the balance reaches zero, an eligible route returns HTTP 402 with error 'insufficient_prepaid_balance' and you can top up again at POST /v1/subscription. ## Not implemented `/v1/priority` is specified in the manifest but returns `501 Not Implemented`. It is not advertised as available. ## Discovery artifacts - `GET /` — health JSON with `Accept: application/json`, otherwise landing HTML - `GET /v1/manifest.json` — MCP tool manifest, JSON Schemas, per-network pricing - `GET /.well-known/x402` — x402 Bazaar service descriptor - `GET /server.json` — MCP Registry `ServerJSON` - `GET /llms.txt`, `GET /llms-full.txt` — this file and the index