Introduction
The Problem
Section titled “The Problem”AI agents need to use paid APIs, but they can’t:
- Discover which APIs exist and what they cost
- Evaluate which APIs are trustworthy
- Pay for API calls autonomously
The Solution: x402 Relay
Section titled “The Solution: x402 Relay”x402 Relay is an open-source API catalog and payment facilitator that enables AI agents to:
- Search a curated directory of x402-enabled APIs
- Evaluate APIs using Trust Scores (protocol compliance, uptime, on-chain history)
- Pay via HTTP 402 Payment Required protocol using USDC on Base
How Agents Use It
Section titled “How Agents Use It”Via MCP (Recommended)
Section titled “Via MCP (Recommended)”{ "mcpServers": { "x402-relay": { "command": "node", "args": ["/path/to/x402-relay/dist/mcp-server.js"] } }}Via REST API
Section titled “Via REST API”# Search for AI APIscurl https://api.x402relay.com/api/services?query=image+generation
# Get service detailscurl https://api.x402relay.com/api/services/svc-neural-api-1Via SDK (Coming Soon)
Section titled “Via SDK (Coming Soon)”import { X402Client } from '@x402relay/sdk';
const client = new X402Client();const services = await client.search('image generation');Architecture
Section titled “Architecture”AI Agent │ ├─ MCP ──► x402 Relay MCP Server ├─ HTTP ─► x402 Relay REST API └─ SDK ──► @x402relay/sdk │ ▼ ┌─────────────┐ │ Catalog DB │ ◄── x402scan Crawler │ Trust Score │ ◄── On-chain Tracer │ Health Check│ ◄── Prober v1/v2 └─────────────┘Next Steps
Section titled “Next Steps”- Quick Start — Get up and running in 5 minutes
- How It Works — Understand the x402 protocol
- MCP Integration — Connect your AI agent