x402 payment protocol for AI agents. Enables autonomous micropayments using HTTP 402 status codes and stablecoins. Use when you need to pay for API access, accept payments for your services, or interact with x402-enabled endpoints.
基于HTTP 402和稳定币的AI代理自主支付协议。
x402是一种面向互联网原生支付的开放标准。它使AI代理能够使用稳定币自动支付API调用费用,无需账户或人工干预。
工作原理:
主要优势:
bash
neckr0ik-x402-payments check https://api.example.com/premium
bash
neckr0ik-x402-payments pay https://api.example.com/premium --amount 0.01
bash
neckr0ik-x402-payments serve --port 8080 --price 0.01
代理 x402协调器 API服务器
| | |
|-- GET /premium ------>|----------------------->|
| | |
|<-- HTTP 402 -----------|------------------------|
| (需要支付) | |
| {金额, 地址, | |
| 链, 协调器} | |
| | |
|-- 签署支付 ---------->| |
| | |
| |-- 提交到链 ---------->|
| | |
| |<-- 确认 ---------------|
| | |
|-- GET /premium --------|----------------------->|
| 支付签名 | |
| | |
|<-- 200 OK -------------|------------------------|
| (数据) | |
检查端点是否支持x402支付。
bash
neckr0ik-x402-payments check
选项:
--timeout <毫秒> 请求超时时间(默认:10000)
支付API访问费用并接收数据。
bash
neckr0ik-x402-payments pay
选项:
--amount <金额> 最大支付金额(美元)
--chain <链> 首选链(默认:base)
--token <代币> 稳定币代币(默认:usdc)
--wallet <地址> 用于支付的钱包
--dry-run 显示支付详情但不实际支付
启动支持x402的API服务器。
bash
neckr0ik-x402-payments serve [选项]
选项:
--port <端口> 服务器端口(默认:8080)
--price <金额> 每次请求价格(美元)
--chain <链> 接受支付的链(默认:base)
--token <代币> 接受的稳定币(默认:usdc)
--wallet <地址> 收款钱包地址
查看支付钱包余额。
bash
neckr0ik-x402-payments balance [选项]
选项:
--chain <链> 要检查的链(默认:全部)
查看支付历史。
bash
neckr0ik-x402-payments history [选项]
选项:
--limit <数量> 交易数量(默认:10)
--chain <链> 按链筛选
设置支付钱包:
bash
python
python
from x402 import PaymentMiddleware
app = Flask(name)
app.wsgiapp = PaymentMiddleware(app.wsgiapp, price=0.01)
@app.route(/premium-data)
def premium_data():
return {data: only accessible after payment}
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 neckr0ik-x402-payments-1776198611 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 neckr0ik-x402-payments-1776198611 技能
skillhub install neckr0ik-x402-payments-1776198611
文件大小: 6.77 KB | 发布时间: 2026-4-15 12:52