在几分钟内部署 x402 按调用付费 API端点,将任意 OpenClaw 技能或服务转为接受 Base 上 USDC 的付费端点,包含支付验证。
Deploy x402-compatible pay-per-call endpoints that accept USDC payments from AI agents on Base.
HTTP 402 ("Payment Required") is the standard for machine-to-machine payments. An agent sends a request, gets a 402 response with pricing info, pays in USDC on Base, and receives the data. No API keys, no accounts, no subscriptions.
Ecosystem (Q1 2026): Stripe, Cloudflare, Google (AP2), Coinbase all ship native x402 support.
bash
bash scripts/scaffold.sh my-service "My cool API" 0.01
Creates a ready-to-run Express server with x402 payment middleware at ./my-service/.
Set your Base wallet address to receive payments:
bash
# In the generated .env file
WALLET_ADDRESS=0xYourBaseWalletAddress
USDC_CONTRACT=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
CHAIN_ID=8453
PORT=3402
bash
cd my-service && npm install && node server.js
bash
cloudflared tunnel --url http://localhost:3402
text
Agent → GET /api/data → 402 Payment Required
├── price: "0.01 USDC"
├── payTo: "0x..."
└── network: "base"
Agent → pays USDC on Base → gets tx hash
Agent → GET /api/data (X-Payment-Tx: 0x...) → 200 OK + data
402 with pricingX-Payment-Tx header → verify on-chain402 againHigh-value endpoints AI agents will pay for:
EndpointPriceDescription/alpha/scan$0.50-1.00Token/project analysis with scoring/market/signal$0.10Real-time trading signals/research/report$1.00Deep research on any topic/data/portfolio$0.05Multi-chain portfolio snapshot/tools/scrape$0.02Clean web content extraction/ai/inference$0.04LLM inference routing
The scaffold includes scripts/verify-payment.js for on-chain verification:
javascript
// Verifies USDC transfer on Base
const verified = await verifyPayment(txHash, expectedAmount, recipientAddress);
Uses Base RPC (free tier) — no API key needed for basic verification.
Add to your agent's capabilities:
json5
// In SKILL.md or agent config
{
tools: [{
name: "my_x402_service",
endpoint: "https://my-service.example.com/api",
payment: { currency: "USDC", network: "base" }
}]
}
Zero-cost hosting on your existing machine:
bash
# One-time setup
cloudflared tunnel create my-x402
cloudflared tunnel route dns my-x402 api.mydomain.com
# Run
cloudflared tunnel run --url http://localhost:3402 my-x402
Register your endpoint on Spraay to get discovered by agents automatically:
bash
curl -X POST https://gateway.spraay.app/register \
-H "Content-Type: application/json" \
-d '{"url": "https://api.mydomain.com", "category": "data", "price": "0.01"}'
Start low, raise prices when you have traction. Better to have 1000 calls at $0.01 than 0 calls at $1.00.