Skip to content

Introduction

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

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

How Agents Use It

{
"mcpServers": {
"x402-relay": {
"command": "node",
"args": ["/path/to/x402-relay/dist/mcp-server.js"]
}
}
}

Via REST API

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

Via SDK (Coming Soon)

import { X402Client } from '@x402relay/sdk';
const client = new X402Client();
const services = await client.search('image generation');

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