Getting Started

RelAI Documentation

Accept payments in your API in under 60 seconds.

Turn any endpoint into a paid resource using HTTP 402. No wallets. No gas. No billing infrastructure.

server.ts
$ npm install @relai-fi/x402

import { relai } from "@relai-fi/x402"

app.use(relai({
  price: "0.001",
  wallet: "your-address"
}))
Every request to your API now requires payment

Quick Start

Add payments to any endpoint:

api.ts
app.get("/premium",
  relai({ price: "0.002" }),
  (req, res) => {
    res.json({ data: "paid response" })
  }
)

Try it

$ curl https://your-api.com/premium

# → HTTP 402 Payment Required
# → after payment → 200 OK + response

How it works

From HTTP request to on-chain payment in seconds.

Clientx402Your APIFacilitatorBlockchain
01Client sends request to your API
02If unpaid → HTTP 402 Payment Required
03Client signs payment (USDC, EIP-3009 or SPL)
04Facilitator executes on-chain settlement
05Request succeeds — your handler responds

Payments complete in seconds. No wallets in your code.

What you get

Pay per request
No subscriptions or billing logic
No wallet logic
Zero blockchain code in your app
Gasless
RelAI sponsors all transaction fees
Multi-chain
Solana, Base, Avalanche, SKALE
Instant settlement
On-chain confirmation in seconds

SDK Basics

Installation

$ npm install @relai-fi/x402

Basic usage — protect all routes

server.ts
import { relai } from "@relai-fi/x402"

app.use(relai({
  price: "0.001"
}))

Per-endpoint pricing

api.ts
app.get("/data",
  relai({ price: "0.005" }),
  handler
)

Full SDK docs → @relai-fi/x402 reference

Pricing & Free tier

You define the price per request. Any amount in USDC.

relai({ price: "0.001" })

Allow free requests before charging

Configure a free tier per caller — no code changes needed. Uses JWT identity or IP address for tracking.

Try before you pay
perBuyerLimit: 3
resetPeriod: none
Daily quota
perBuyerLimit: 10
resetPeriod: daily
Beta budget
perBuyerLimit: 100
globalCap: 1000

Full docs → Free Tier plugin

Facilitator

The RelAI facilitator is the backend service that handles all payment logic. You don't run any blockchain infrastructure.

Payment verification — validates x402 headers and signatures
On-chain settlement — signs and broadcasts USDC transactions
Gas sponsorship — RelAI pays all transaction fees
Transaction confirmation — waits for on-chain finality
Your APIExpress / Fastify / any Node.js framework
RelAI Facilitatorverify · settle · confirm · sponsor
BlockchainSolana · Base · Avalanche · SKALE

Full docs → RelAI Facilitator page or Facilitator reference

API Endpoints

Base URL
https://facilitator.x402.fi
POST/verify
POST/settle
GET/activity
GET/live-settlements

Live payments

Real-time settlement activity across all supported networks.

Settles (24h)

0
Active chains0
Last update

Volume (24h)

$0.00

USDC settled via RelAI

Active chains

No data yet

Live feed

Auto-refresh 30s

Activity Trends

Hourly · last 24h

Volume
$0.00
$0$0$0$0
Time (UTC)0 settles in window

Settlement cadence

0 settles across window

Last refresh

LIVE
No recent settlements

Supported networks

All payments settle in USDC.

Solana
Mainnet · Devnet
SPL Token
Base · Avalanche · Polygon
EVM chains
EIP-3009
SKALE
Zero gas
SKALE Base

Full list → Networks & chain IDs

Advanced

Start building with RelAI

Integrate payments into your API in minutes.

    RelAI Documentation — Accept payments in your API in under 60 seconds | RelAI