Ship a paid tool in five minutes.
@keryxhq/middleware wraps any HTTP handler so agents can pay per call with x402 + USDC on Arc. Zero runtime deps. You are payTo onchain (100% of the call today). The 5% platform fee is ledger accounting until split settlement ships.
viem is a peer dep.The whole integration.
First hit returns 402. Agent pays. Your handler runs. That’s the whole thing.
Three steps. The SDK does all three.
Agent calls your endpoint
POST /api/my-tool with no X-PAYMENT header. The SDK returns HTTP 402 + a machine-readable body: exact USDC amount, asset address, your wallet, network, expiry.
Agent signs and retries
The agent reads the 402, signs an EIP-3009 USDC authorization to your wallet for the exact amount, base64-encodes it, retries the same request with X-PAYMENT set.
SDK verifies, your handler runs
Three-tier verification: structural (amount, recipient, expiry), cryptographic (EIP-3009 signer recovery via viem), and optional settlement (facilitator broadcasts onchain and returns a tx hash). Your handler runs with the receipt attached — you never touch the payment logic.
Same idea, connect-style.
Use the framework-agnostic primitives.
Cloudflare Workers, Deno, Hono, Fastify, bare Node http.Server. If you can read a header, you can accept x402.
Arc-native, USDC-priced.
The SDK ships with two Arc networks baked in. Arc is a stablecoin-native chain built by Circle where gas itself is denominated in USDC, so a sub-cent call doesn’t get eaten alive by transaction fees. That’s the only price band where per-call payments make sense.
Deploy the wrapped handler. Publish the URL. Get paid.
One page. Wallet-signed. Your tool is discoverable to every agent in Claude, Cursor, and GitHub Copilot via MCP.