Build paid APIs, paywalls, and AI agent payments using the HTTP 402 protocol with on-chain settlement.
Data & analysis
x402-api-builder
Try itBuild your own pay-per-call API with the x402 standard: FastAPI + payment manifest + API keys + MCP wrapper. Sell your data/services per call (USDC). Template with ON-CHAIN payment verification (secure-by-default).
What it does
Build your own pay-per-call API with the x402 standard: FastAPI + payment manifest + API keys + MCP wrapper. Sell your data/services per call (USDC). Template with ON-CHAIN payment verification (secure-by-default).
The skill document
X402 API Builder 💳🔌
Turn your data/service into a paid pay-per-call API in under an hour.
What you get
- FastAPI server with paid endpoints (template)
- x402 manifest (
/.well-known/x402) — so other agents can discover you - Payment flow: customer pays USDC → sends txHash → gets API key
- 401/402 gates — no free calls
- MCP wrapper — your API as MCP tools (get_signals, get_market, etc.)
Quick start
# 1) Install
pip install fastapi uvicorn
# 2) Copy the template
cp scripts/server.py .
cp scripts/mcp_server.py .
# 3) Add YOUR endpoints (see TODO in server.py)
# 4) Run
uvicorn server:app --host 0.0.0.0 --port 8791 &
# 5) Verify manifest
curl http://YOUR_IP:8791/.well-known/x402
Pricing (recommended)
| Product | Price |
|---|---|
| Per call | $0.005 (market: $0.001-0.01) |
| Monthly (unlimited) | $25 |
| Premium (live + alerts) | $100 |
| Enterprise (SLA + white-label) | $500 |
Security (critical)
- On-chain verification (secure-by-default):
/v1/purchaseonly issues an API key after the txHash is verified on-chain (eth_getTransactionByHash + receipt status against Base RPC). Unreachable RPC or invalid tx = purchase denied (402). - Never commit api_keys.json (gitignore it!)
- API key = HMAC of txHash (verifiable, not guessable)
- 401 without key · 402 when call usage is exhausted or payment is not verified
- Client: refuses to send the key over plain HTTP to non-local hosts (use X402_BASE=https://...)
- Rate-limit per key
Files
x402-api-builder/
├── SKILL.md
└── scripts/
├── server.py # FastAPI template (manifest + purchase + gates)
├── mcp_server.py # MCP wrapper (fastmcp)
└── client.py # Test client
Related skills
x402 payment client for AI agents — how to automatically respond to HTTP 402 challenges, pay via CDP/Permit2, retry with PAYMENT-SIGNATURE, and settle the full x402 flow. For consuming pay-per-request APIs without API keys or subscriptions.
Autonomously monetize your services with x402 payment collection. Set up an x402 server, define paid endpoints, and accept programmatic payments in stablecoins. Become part of the agent-to-agent economy!
Provides pay-per-call crypto trading signals with entry, stop-loss and take-profit via the x402 standard (USDC on Ethereum). Live DRT/ICT signals for agents and traders.
Reference client for paying x402 (USDC/EVM) and L402 (Lightning) HTTP 402 paywalls. Detects payment requirements, signs/settles payments only with explicitly...
Pay x402 with Agent Wallet, then continue the task