x402 Quickstart
/install x402-quickstart
x402 Quickstart
Deploy x402-compatible pay-per-call endpoints that accept USDC payments from AI agents on Base.
What is x402?
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.
Quick Deploy
1. Generate endpoint scaffold
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/.
2. Configure wallet
Set your Base wallet address to receive payments:
# In the generated .env file
WALLET_ADDRESS=0xYourBaseWalletAddress
USDC_CONTRACT=0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
CHAIN_ID=8453
PORT=3402
3. Run locally
cd my-service && npm install && node server.js
4. Expose via Cloudflare Tunnel (zero cost)
cloudflared tunnel --url http://localhost:3402
How It Works
Agent Flow
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
Server Flow
- Request arrives without payment → respond
402with pricing - Request arrives with
X-Payment-Txheader → verify on-chain - If payment confirmed → serve data
- If payment fails → respond
402again
Endpoint Ideas
High-value endpoints AI agents will pay for:
| Endpoint | Price | Description |
|---|---|---|
/alpha/scan |
$0.50-1.00 | Token/project analysis with scoring |
/market/signal |
$0.10 | Real-time trading signals |
/research/report |
$1.00 | Deep research on any topic |
/data/portfolio |
$0.05 | Multi-chain portfolio snapshot |
/tools/scrape |
$0.02 | Clean web content extraction |
/ai/inference |
$0.04 | LLM inference routing |
Payment Verification
The scaffold includes scripts/verify-payment.js for on-chain verification:
// Verifies USDC transfer on Base
const verified = await verifyPayment(txHash, expectedAmount, recipientAddress);
Uses Base RPC (free tier) — no API key needed for basic verification.
Integration with OpenClaw
As a skill endpoint
Add to your agent's capabilities:
// In SKILL.md or agent config
{
tools: [{
name: "my_x402_service",
endpoint: "https://my-service.example.com/api",
payment: { currency: "USDC", network: "base" }
}]
}
With Cloudflare Tunnel
Zero-cost hosting on your existing machine:
# 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
Spraay Gateway Integration
Register your endpoint on Spraay to get discovered by agents automatically:
curl -X POST https://gateway.spraay.app/register \
-H "Content-Type: application/json" \
-d '{"url": "https://api.mydomain.com", "category": "data", "price": "0.01"}'
Pricing Strategy
- Data endpoints: $0.005-0.05 (commodity, high volume)
- Analysis endpoints: $0.10-1.00 (value-add, medium volume)
- Research endpoints: $1.00-5.00 (premium, low volume)
- GPU/compute: $0.05-0.50 (resource-based pricing)
Start low, raise prices when you have traction. Better to have 1000 calls at $0.01 than 0 calls at $1.00.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install x402-quickstart - 安装完成后,直接呼叫该 Skill 的名称或使用
/x402-quickstart触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
x402 Quickstart 是什么?
Deploy x402 pay-per-call API endpoints in minutes. Turn any OpenClaw skill or service into a monetized endpoint accepting USDC on Base. Includes payment veri... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 100 次。
如何安装 x402 Quickstart?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install x402-quickstart」即可一键安装,无需额外配置。
x402 Quickstart 是免费的吗?
是的,x402 Quickstart 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
x402 Quickstart 支持哪些平台?
x402 Quickstart 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 x402 Quickstart?
由 JimmyClanker(@jimmyclanker)开发并维护,当前版本 v1.0.0。