Skip to content

Introduction

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

x402 Relay is an open-source API catalog and payment facilitator that enables AI agents to:

  1. Search a curated directory of x402-enabled APIs
  2. Evaluate APIs using Trust Scores (protocol compliance, uptime, on-chain history)
  3. Pay via HTTP 402 Payment Required protocol using USDC on Base
{
"mcpServers": {
"x402-relay": {
"command": "node",
"args": ["/path/to/x402-relay/dist/mcp-server.js"]
}
}
}
Terminal window
# Search for AI APIs
curl https://api.x402relay.com/api/services?query=image+generation
# Get service details
curl https://api.x402relay.com/api/services/svc-neural-api-1
import { X402Client } from '@x402relay/sdk';
const client = new X402Client();
const services = await client.search('image generation');
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
└─────────────┘