Make x402 payments to access gated APIs and content. Fetch paid resources, check wallet balance, and create payment links. Use when encountering 402 Payment...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install agentic-x402或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install agentic-x402⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/agentic-x402/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: agentic-x402 description: Make x402 payments to access gated APIs and content. Fetch paid resources, check wallet balance, and create payment links. Use when encountering 402 Payment Required responses or when the user wants to pay for web resources with crypto. license: MIT compatibility: Requires Node.js 20+, network access to x402 facilitators and EVM chains homepage: https://www.npmjs.com/package/agentic-x402 metadata: {"author": "monemetrics", "version": "0.2.6", "openclaw": {"requires": {"bins": ["x402"], "env": ["EVM_PRIVATE_KEY"]}, "primaryEnv": "EVM_PRIVATE_KEY", "install": [{"id": "node", "kind": "node", "package": "agentic-x402", "bins": ["x402"], "label": "Install agentic-x402 (npm)"}]}} allowed-tools: Bash(x402:) Bash(npm:) Read ---
Pay for x402-gated APIs and content using USDC on Base. This skill enables agents to autonomously make crypto payments when accessing paid web resources.
| Command | Description | |---------|-------------| | x402 setup | Create or configure wallet | | x402 balance | Check USDC and ETH balances | | x402 pay | Pay for a gated resource | | x402 fetch | Fetch with auto-payment | | x402 create-link | Create payment link (seller) | | x402 link-info | Get payment link details |
npm i -g agentic-x402
Once installed, the x402 command is available globally:
x402 --help
x402 --version
Run the interactive setup to create a new wallet:
x402 setup
This will:
~/.x402/.envImportant: Back up your private key immediately after setup!
Alternatively, set the environment variable directly:
export EVM_PRIVATE_KEY=0x...your_private_key...
Or create a config file:
mkdir -p ~/.x402
echo "EVM_PRIVATE_KEY=0x..." > ~/.x402/.env
chmod 600 ~/.x402/.env
Verify setup:
x402 balance
Use x402 pay to make the payment and access the content:
x402 pay https://api.example.com/paid-endpoint
The command will:
Use x402 fetch for seamless payment handling:
x402 fetch https://api.example.com/data --json
This wraps fetch with x402 payment handling - if the resource requires payment, it's handled automatically.
By default, payments are limited to $10 USD. Override with --max:
x402 pay https://expensive-api.com/data --max 50
Or set globally:
export X402_MAX_PAYMENT_USD=25
Preview payment without executing:
x402 pay https://api.example.com/data --dry-run
Create payment links to monetize your own content using x402-links-server:
Add to .env:
X402_LINKS_API_URL=https://your-x402-links-server.com
Gate a URL:
x402 create-link --name "Premium API" --price 1.00 --url https://api.example.com/premium
Gate text content:
x402 create-link --name "Secret" --price 0.50 --text "The secret message..."
With webhook notification:
x402 create-link --name "Guide" --price 5.00 --url https://mysite.com/guide --webhook https://mysite.com/payment-hook
x402 link-info 0x1234...5678
x402 link-info https://21.cash/pay/0x1234...5678
Check wallet balances.
x402 balance [--json] [--full]
| Flag | Description | Default | |------|-------------|---------| | --json | Output as JSON (address, network, chainId, balances) | — | | --full | Show full wallet address instead of truncated | — | | -h, --help | Show help | — |
Pay for an x402-gated resource.
x402 pay <url> [options]
| Flag | Description | Default | |------|-------------|---------| | | The URL of the x402-gated resource (positional) | required | | --method | HTTP method | GET | | --body | Request body (for POST/PUT requests) | — | | --header | Add custom header (can be used multiple times) | — | | --max | Maximum payment in USD (overrides config) | from config | | --dry-run | Show payment details without paying | — | | -h, --help | Show help | — |
Fetch with automatic payment.
x402 fetch <url> [options]
| Flag | Description | Default | |------|-------------|---------| | | The URL to fetch (positional) | required | | --method | HTTP method | GET | | --body | Request body (for POST/PUT) | — | | --header | Add header as "Key: Value" | — | | --json | Output as JSON only (for piping to other tools) | — | | --raw | Output raw response body only (no headers or status) | — | | -h, --help | Show help | — |
Create a payment link.
x402 create-link --name <name> --price <usd> [options]
| Flag | Description | Default | |------|-------------|---------| | --name | Name of the payment link | required | | --price | Price in USD (e.g., "5.00" or "0.10") | required | | --url | URL to gate behind payment | — | | --text | Text content to gate behind payment | — | | --desc | Description of the link | — | | --webhook | Webhook URL for payment notifications | — | | --json | Output as JSON | — | | -h, --help | Show help | — |
> Note: Either --url or --text is required. The link is deployed as a smart contract on Base.
Get payment link details.
x402 link-info <router-address> [--json]
| Flag | Description | Default | |------|-------------|---------| | | Router contract address or full payment URL (positional) | required | | --json | Output as JSON | — | | -h, --help | Show help | — |
| Variable | Description | Default | |----------|-------------|---------| | EVM_PRIVATE_KEY | Wallet private key (0x-prefixed) | required | | X402_NETWORK | mainnet (Base, chain 8453) or testnet (Base Sepolia, chain 84532) | mainnet | | X402_MAX_PAYMENT_USD | Safety limit — payments exceeding this are rejected unless --max is used | 10 | | X402_FACILITATOR_URL | Custom facilitator URL | Coinbase (mainnet) / x402.org (testnet) | | X402_SLIPPAGE_BPS | Slippage tolerance in basis points (100 bps = 1%) | 50 | | X402_VERBOSE | Enable verbose logging (1 = on, 0 = off) | 0 | | X402_LINKS_API_URL | Base URL of x402-links-server (e.g., https://21.cash) | — |
| Network | Chain ID | CAIP-2 ID | |---------|----------|-----------| | Base Mainnet | 8453 | eip155:8453 | | Base Sepolia | 84532 | eip155:84532 |
All payments use USDC (USD Coin) on the selected network.
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA029130x036CbD53842c5426634e7929541eC2318f3dCF7e402 Payment Required + payment detailsThe x402 protocol is gasless for buyers - the facilitator sponsors gas fees.
Set your wallet private key:
export EVM_PRIVATE_KEY=0x...
Or create a .env file in your working directory, or install globally and use ~/.x402/.env.
Increase the limit:
x402 pay https://... --max 50
...
安装 Agentic X402 后,可以对 AI 说这些话来触发它
Help me get started with Agentic X402
Explains what Agentic X402 does, walks through the setup, and runs a quick demo based on your current project
Use Agentic X402 to make x402 payments to access gated APIs and content
Invokes Agentic X402 with the right parameters and returns the result directly in the conversation
What can I do with Agentic X402 in my developer & devops workflow?
Lists the top use cases for Agentic X402, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/agentic-x402/ 目录(个人级,所有项目可用),或 .claude/skills/agentic-x402/(项目级)。重启 AI 客户端后,用 /agentic-x402 主动调用,或让 AI 根据上下文自动发现并使用。
Agentic X402 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Agentic X402 可免费安装使用。请查阅仓库了解许可证信息。
Make x402 payments to access gated APIs and content. Fetch paid resources, check wallet balance, and create payment links. Use when encountering 402 Payment...
Agentic X402 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Agentic X402
Identifies repetitive steps in your workflow and sets up Agentic X402 to handle them automatically