public/skills/0xterrybit/x402/SKILL.md
Use x402 protocol for HTTP-native crypto payments. Use when Clawdbot needs to pay for APIs, access paid resources, or handle 402 Payment Required responses. Supports USDC payments on Base, Ethereum, and other EVM chains via the x402 standard.
npx skillsauth add demerzels-lab/elsamultiskillagent x402Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
x402 enables instant stablecoin payments directly over HTTP using the 402 Payment Required status code. Perfect for AI agents paying for APIs, data, or compute on-demand.
npm install x402
# or
pnpm add x402
# Store wallet private key securely
export WALLET_PRIVATE_KEY="0x..."
# Optional: specify network RPC
export BASE_RPC_URL="https://mainnet.base.org"
PAYMENT-REQUIRED headerPAYMENT-SIGNATURE headerimport { x402Client } from 'x402';
const client = x402Client({
privateKey: process.env.WALLET_PRIVATE_KEY,
network: 'base', // or 'ethereum', 'arbitrum', etc.
});
// Automatic 402 handling
const response = await client.fetch('https://api.example.com/paid-endpoint');
const data = await response.json();
import { wrapFetch } from 'x402';
const fetch402 = wrapFetch(fetch, {
privateKey: process.env.WALLET_PRIVATE_KEY,
});
// Use like normal fetch - 402s handled automatically
const res = await fetch402('https://paid-api.com/data');
curl -i https://api.example.com/paid-resource
# Returns 402 with PAYMENT-REQUIRED header (base64 JSON)
# The PAYMENT-REQUIRED header contains base64-encoded JSON:
# {
# "amount": "1000000", # 1 USDC (6 decimals)
# "currency": "USDC",
# "network": "base",
# "recipient": "0x...",
# "scheme": "exact"
# }
# Use x402 CLI or SDK to create payment signature
npx x402 pay \
--amount 1000000 \
--recipient 0x... \
--network base
curl -H "PAYMENT-SIGNATURE: <base64_payload>" \
https://api.example.com/paid-resource
// Weather API that costs 0.001 USDC per call
const weather = await client.fetch('https://weather-api.x402.org/forecast?city=NYC');
// LLM API with per-token pricing
const completion = await client.fetch('https://llm.example.com/v1/chat', {
method: 'POST',
body: JSON.stringify({ prompt: 'Hello' }),
});
import { getBalance } from 'x402';
const balance = await getBalance({
address: walletAddress,
network: 'base',
token: 'USDC',
});
if (balance < requiredAmount) {
console.log('Insufficient USDC balance');
}
| Network | Chain ID | Status | |---------|----------|--------| | Base | 8453 | ✅ Primary | | Ethereum | 1 | ✅ Supported | | Arbitrum | 42161 | ✅ Supported | | Optimism | 10 | ✅ Supported | | Polygon | 137 | ✅ Supported |
try {
const res = await client.fetch(url);
} catch (err) {
if (err.code === 'INSUFFICIENT_BALANCE') {
// Need to fund wallet
} else if (err.code === 'PAYMENT_FAILED') {
// Transaction failed on-chain
} else if (err.code === 'INVALID_PAYMENT_REQUIREMENTS') {
// Server sent malformed 402 response
}
}
op run or similar for secret injection/.well-known/x402testing
Query real-time and historical financial data across equities and crypto—prices, market moves, metrics, and trends for analysis, alerts, and reporting.
data-ai
YouTube SERP Scout for agents. Search top-ranking videos, channels, and trends for content research and competitor tracking.
development
Search X (Twitter) in real time, extract relevant posts, and publish tweets/replies instantly—perfect for social listening, engagement, and rapid content ops.
development
Intelligent search for agents. Multi-source retrieval with confidence scoring - web, academic, and Tavily in one unified API.