Make x402 payments. Pay for APIs, sell your services, handle 402 Payment Required responses with USDC on Base and other EVM chains.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install xclaw02或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install xclaw02⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/xclaw02/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: xclaw02 description: Make x402 payments. Pay for APIs, sell your services, handle 402 Payment Required responses with USDC on Base and other EVM chains. metadata: {"openclaw":{"emoji":"$","requires":{"anyBins":["node","npx","python3","pip"]}}} ---
Your entry point into x402 - the open payment standard for the agentic web.
x402 is an open protocol enabling instant stablecoin payments over HTTP using the 402 Payment Required status code. xClaw02, built by Primer, provides agent-friendly CLI tools and simple APIs for making and receiving payments.
Use xClaw02 when:
| User Says/Asks | What to Do | |----------------|------------| | "I got a 402 error" | This is an x402 payment request. Probe the URL with xclaw02 probe , show the price, ask if they want to pay | | "Pay for this API" | Use xclaw02 pay - always confirm amount with user first | | "Check my balance" | Run xclaw02 wallet balance | | "Set up x402" / "Set up payments" | Run xclaw02 openclaw init | | "What networks do you support?" | List supported networks (Base is primary; also Ethereum, Arbitrum, Optimism, Polygon) | | "How much does X cost?" | Probe the URL with xclaw02 probe to get pricing | | "Create a wallet" | Run xclaw02 wallet create - remind user to save the private key securely | | "I want to charge for my API" | Show the Express.js or FastAPI middleware examples |
npx xclaw02 openclaw init
pip install xclaw02
xclaw02 openclaw init
This will:
~/.openclaw/skills/xclaw02/PAYMENT-SIGNATURE headerThe payment is gasless for the payer - the facilitator handles gas fees.
| Command | Description | |---------|-------------| | xclaw02 openclaw init | Set up xClaw02 for this agent | | xclaw02 openclaw status | Check setup status and balance | | xclaw02 probe | Check if URL requires payment and get price | | xclaw02 pay | Pay for a resource (requires XCLAW02_PRIVATE_KEY) | | xclaw02 pay | Preview payment without paying | | xclaw02 pay | Pay with spending limit | | xclaw02 wallet create | Create a new wallet | | xclaw02 wallet balance | Check USDC balance on Base | | xclaw02 wallet from-mnemonic | Restore wallet from mnemonic | | xclaw02 networks | List supported networks |
$ xclaw02 probe https://api.example.com/paid
{
"status": "payment_required",
"price": "0.05",
"currency": "USDC",
"network": "base",
"recipient": "0x1234...abcd",
"description": "Premium API access"
}
$ xclaw02 wallet balance 0xYourAddress
{
"address": "0xYourAddress",
"network": "base",
"balance": "12.50",
"token": "USDC"
}
$ xclaw02 pay https://api.example.com/paid --max-amount 0.10
{
"status": "success",
"paid": "0.05",
"txHash": "0xabc123...",
"response": { ... }
}
const { createSigner, x402Fetch } = require('xclaw02');
// Private key format: 0x followed by 64 hex characters
const signer = await createSigner('eip155:8453', process.env.XCLAW02_PRIVATE_KEY);
const response = await x402Fetch('https://api.example.com/paid', signer, {
maxAmount: '0.10' // Maximum USDC to spend
});
const data = await response.json();
from xclaw02 import create_signer, x402_requests
import os
# Private key format: 0x followed by 64 hex characters
signer = create_signer('eip155:8453', os.environ['XCLAW02_PRIVATE_KEY'])
with x402_requests(signer, max_amount='0.10') as session:
response = session.get('https://api.example.com/paid')
data = response.json()
Want other agents to pay you? Add a paywall to your API:
const express = require('express');
const { x402Express } = require('xclaw02');
const app = express();
app.use(x402Express('0xYourAddress', {
'/api/premium': {
amount: '0.05', // $0.05 USDC per request
asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
network: 'eip155:8453'
}
}));
app.get('/api/premium', (req, res) => {
res.json({ data: 'Premium content here' });
});
from fastapi import FastAPI
from xclaw02 import x402_fastapi
app = FastAPI()
app.add_middleware(x402_fastapi(
'0xYourAddress',
{
'/api/premium': {
'amount': '0.05',
'asset': '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
'network': 'eip155:8453'
}
}
))
@app.get("/api/premium")
async def premium_endpoint():
return {"data": "Premium content here"}
| Network | CAIP-2 ID | Token | Notes | |---------|-----------|-------|-------| | Base | eip155:8453 | USDC | Primary - fast, cheap, recommended | | Base Sepolia | eip155:84532 | USDC | Testnet | | Ethereum | eip155:1 | USDC | Higher fees | | Arbitrum | eip155:42161 | USDC | | | Optimism | eip155:10 | USDC | | | Polygon | eip155:137 | USDC | |
Base is the default network. To use others, set XCLAW02_NETWORK environment variable.
Facilitators handle payment verification and on-chain settlement. The x402 ecosystem has many independent facilitators:
| Name | URL | Notes | |------|-----|-------| | Primer | https://x402.primer.systems | Default | | Coinbase | https://api.cdp.coinbase.com/platform/v2/x402 | | | x402.org | https://x402.org/facilitator | Testnet only | | PayAI | https://facilitator.payai.network | | | Corbits | https://facilitator.corbits.dev | | | Dexter | https://x402.dexter.cash | | | Heurist | https://facilitator.heurist.xyz | | | Kobaru | https://gateway.kobaru.io | | | Nevermined | https://api.live.nevermined.app/api/v1/ | | | Openfacilitator | https://pay.openfacilitator.io | | | Solpay | https://x402.solpay.cash | | | xEcho | https://facilitator.xechoai.xyz | |
To use a different facilitator, set XCLAW02_FACILITATOR environment variable.
| Variable | Format | Description | |----------|--------|-------------| | XCLAW02_PRIVATE_KEY | 0x + 64 hex chars | Wallet private key (required for payments) | | XCLAW02_NETWORK | eip155:8453, base, etc. | Default network (default: base) | | XCLAW02_MAX_AMOUNT | 0.10 | Default max payment amount in USDC | | XCLAW02_FACILITATOR | URL | Facilitator URL override |
| Error Code | Meaning | What to Do | |------------|---------|------------| | INSUFFICIENT_FUNDS | Wallet balance too low | Tell user to fund wallet with USDC on Base | | AMOUNT_EXCEEDS_MAX | Payment exceeds maxAmount | Ask user to approve higher amount, then retry with --max-amount | | SETTLEMENT_FAILED | On-chain settlement failed | Wait a moment and retry, or try a different facilitator | | INVALID_RESPONSE | Malformed 402 response | The URL may not support x402 properly | | NETWORK_MISMATCH | Wrong network | Check the 402 response for required network, set XCLAW02_NETWORK |
...
安装 xClaw02 后,可以对 AI 说这些话来触发它
Help me get started with xClaw02
Explains what xClaw02 does, walks through the setup, and runs a quick demo based on your current project
Use xClaw02 to make x402 payments
Invokes xClaw02 with the right parameters and returns the result directly in the conversation
What can I do with xClaw02 in my developer & devops workflow?
Lists the top use cases for xClaw02, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/xclaw02/ 目录(个人级,所有项目可用),或 .claude/skills/xclaw02/(项目级)。重启 AI 客户端后,用 /xclaw02 主动调用,或让 AI 根据上下文自动发现并使用。
xClaw02 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
xClaw02 可免费安装使用。请查阅仓库了解许可证信息。
Make x402 payments. Pay for APIs, sell your services, handle 402 Payment Required responses with USDC on Base and other EVM chains.
xClaw02 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using xClaw02
Identifies repetitive steps in your workflow and sets up xClaw02 to handle them automatically