---
name: 0mod-api-gateway
description: Payment-gated x402 microservices for AI agents — web/RAG/OCR/AI utilities plus CEX-DEX market-microstructure telemetry. No API key; settled in USDC on Base.
categories: Data, AI, Finance, Blockchain, Trading
keywords: market-microstructure, cex-dex-spread, spread, basis, dislocation, arbitrage, execution-quality, execution-latency, slippage, market-impact, pre-trade-simulator, telemetry, order-flow, real-time, crypto, trading, signals, on-chain, mcp, openapi, a2a, ocr, image-ocr, rag, stealth-dom
---

# Skill: 0mod API Gateway (x402 microservices)

> Use this skill when an agent needs **paid, pay-per-call** utilities it can
> reach over plain HTTP with **no API key** and **no signup** — web scraping,
> PII redaction, image OCR, RDAP domain lookup, DEX pricing, and CEX-DEX
> market-microstructure telemetry. Payment is settled per call in USDC on Base
> via the x402 protocol.

## When to use this skill

### Web & content ingestion

Use when you must read a live web page, or shrink a public image into a token-cheap context window before an LLM call.

  - `POST /api/v1/stealth-dom` — Stealth DOM — headless edge web scraper for AI agents. Fetches any public URL and returns raw HTML or clean Markdown (up to 10,000 chars); SSRF-validated, runs at the Cloudflare edge in ~70ms, no API key.
    tags: stealth-dom, rag, real-time, mcp, openapi, a2a
  - `POST /api/v1/image-ocr-shrink` — Image OCR Shrink — vision OCR-to-markdown for AI agents. Extracts clean text and table markdown from public image URLs with Workers AI Vision Llama 3.2, saving ~95% of the tokens a raw image would consume; no API key.
    tags: ocr, image-ocr, rag, mcp, openapi, a2a

### Privacy, lookup & market utilities

Use when you must redact PII/PCI before sending text to a model, check a domain, or pull real-time DEX pricing.

  - `POST /api/v1/airgap-scrub` — Airgap Scrub — pre-LLM PII/PCI redaction for AI agents. Scrubs SSNs, credit cards, phones, addresses, emails and ZIPs before text reaches an LLM or log sink; stateless with zero data retention, optional Workers AI deep redaction, no API key.
    tags: rag, real-time, mcp, openapi, a2a
  - `POST /api/v1/domain-check` — Domain Check — global RDAP/WHOIS lookup for AI agents. Resolves availability, status, registrar, registration/expiry dates and nameservers for .com, .net, .org and global TLDs from the Cloudflare edge; no API key.
    tags: real-time, mcp, openapi, a2a
  - `POST /api/v1/dex-price-summary` — DEX Price Summary — real-time DEX market data for AI agents. Returns token price, 24h volume, liquidity and top pair stats across chains (DexScreener) for trading bots and research agents; no API key.
    tags: crypto, trading, signals, real-time, on-chain, mcp, openapi, a2a

### Crypto market-microstructure telemetry

Use when you need CEX-DEX spread/basis telemetry, arbitrage dislocation events, fill-latency benchmarks, or a pre-trade impact simulation. Query `/api/v1/crypto/coverage` (free) first to confirm the pair/date window.

  - `GET /api/v1/crypto/coverage` — Crypto Coverage — free CEX-DEX telemetry discovery for AI agents. Returns supported pairs, earliest/latest timestamps, slice interval and the full telemetry endpoint map; no API key, no payment — use it to plan your query window.
    tags: telemetry, market-microstructure, crypto, trading, mcp, openapi, a2a
  - `GET /api/v1/crypto/spread-candles` — Spread Candles — cross-venue CEX-DEX spread OHLC for AI agents. Returns 15-minute raw/net spread bps candles, average net spread, book depth and dislocation counts for pairs like AERO/USD, ETH/USD and cbBTC/USD on Base; historical R2 slices, no API key.
    tags: market-microstructure, cex-dex-spread, spread, telemetry, crypto, trading, real-time, order-flow, mcp, openapi, a2a
  - `GET /api/v1/crypto/dislocations` — Dislocations — CEX-DEX arbitrage events for AI agents. Returns synchronized cross-venue dislocation events (Coinbase vs Aerodrome Base DEX) with buy/sell venue, prices, raw/net bps, estimated profit and liquidity depth; real-time-sliced, no API key.
    tags: dislocation, arbitrage, cex-dex-spread, spread, basis, telemetry, crypto, trading, real-time, order-flow, on-chain, mcp, openapi, a2a
  - `GET /api/v1/crypto/execution-latency` — Execution Latency — cross-venue fill-speed benchmarks for AI agents. Returns p50/p90/p99/min/max latencies, fill rate and per-venue broadcast timings for Coinbase REST vs Aerodrome DEX; empirical execution-quality telemetry for routing decisions, no API key.
    tags: execution-latency, execution-quality, telemetry, crypto, trading, real-time, order-flow, mcp, openapi, a2a
  - `POST /api/v1/crypto/impact-simulation` — Impact Simulation — pre-trade slippage simulator for AI agents. Runs a read-only PAPER order against the LIVE L2 book and returns expected VWAP fill price, slippage in bps, fillable size and fill probability; no order is placed, no custody touched, no API key.
    tags: slippage, market-impact, pre-trade-simulator, execution-quality, crypto, trading, real-time, order-flow, mcp, openapi, a2a

## How to invoke a SKU

1. **Discover** the SKU + current price from `https://api.0mod.com/api/v1/discovery`
   (or the `PAYMENT-REQUIRED` header of the 402 challenge — never hardcode a price).
2. **Probe** the endpoint with no payment header → `402 Payment Required`.
3. **Pay** by signing an EIP-3009 `transferWithAuthorization` for the advertised
   atomic USDC amount on Base (`eip155:8453`).
4. **Retry** with the `PAYMENT-SIGNATURE` header → `200 OK` JSON result.

Minimal client (`EVM_PRIVATE_KEY` + `@x402/fetch`):

```ts
// npm i @x402/fetch @x402/core @x402/evm viem
import { wrapFetchWithPayment } from '@x402/fetch';
import { x402Client } from '@x402/core/client';
import { registerExactEvmScheme } from '@x402/evm/exact/client';
import { privateKeyToAccount } from 'viem/accounts';

// 1) Load the paying wallet from the environment. NEVER commit this key.
const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);

// 2) Build an x402 client and register the EVM "exact" scheme with the signer.
const client = new x402Client();
registerExactEvmScheme(client, { signer: account });

// 3) Wrap fetch. It now transparently handles 402 → sign → retry → 200.
const paidFetch = wrapFetchWithPayment(fetch, client);

const res = await paidFetch('https://api.0mod.com/api/v1/stealth-dom', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ url: 'https://example.com', format: 'markdown' }),
});
if (!res.ok) throw new Error(`paid call failed: ${res.status}`);
console.log(await res.json()); // 200 body — the PAID response
```

## Protocol & schema cards

- Agent manifest (agent-json): `https://api.0mod.com/.well-known/agent.json`
- Agents spec (OpenAI-style): `https://api.0mod.com/agents.json`
- A2A agent card: `https://api.0mod.com/.well-known/agent-card.json`
- MCP server card: `https://api.0mod.com/.well-known/mcp.json`
- OpenAPI 3.1 (input schemas + examples): `https://api.0mod.com/openapi.json`
- Full integration guide: `https://api.0mod.com/agents.md`
- LLM index: `https://api.0mod.com/llms.txt`

## Rules

- Only `200` responses are billable; `402`/`400`/`404`/`5xx` are never settled.
- Read the price from `/api/v1/discovery` or the 402 header at call time.
- Free SKUs: `/api/v1/crypto/coverage`, `/health`, `/api/v1/discovery`, `/skill.md`, `/llms.txt`.
