agentxpayAgentXPay Skill — 让 AI Agent 在 Monad 链上通过 x402 协议自主发现、付费、订阅 AI 服务。支持链上支付、Agent 钱包管理、服务订阅和资金托管。
Install via ClawdBot CLI:
clawdbot install JasonRUAN/agentxpay让 AI Agent 具备在 Monad 区块链上自主发现 AI 服务、链上付费、管理钱包的能力。
核心机制:通过 x402 协议(HTTP 402 Payment Required),Agent 发送请求 → 收到 402 → 自动链上支付 → 携带交易哈希重试 → 获取 AI 服务响应,全程无需人工介入。
在使用本 Skill 前,需要确保以下配置可用:
| 变量 | 必填 | 说明 |
|------|------|------|
| RPC_URL | 是 | Monad RPC 节点地址 |
| PRIVATE_KEY | 是 | Agent 钱包私钥 |
| SERVICE_REGISTRY_ADDRESS | 是 | ServiceRegistry 合约地址 |
| PAYMENT_MANAGER_ADDRESS | 是 | PaymentManager 合约地址 |
| SUBSCRIPTION_MANAGER_ADDRESS | 否 | SubscriptionManager 合约地址 |
| ESCROW_ADDRESS | 否 | Escrow 合约地址 |
| AGENT_WALLET_FACTORY_ADDRESS | 否 | AgentWalletFactory 合约地址 |
@agentxpay/sdk、ethers v6本 Skill 提供以下 7 个 Tool,AI 可根据任务需要选择调用:
agentxpay_discover_services用途:在 Monad 链上发现已注册的 AI 服务。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| category | string | 否 | 服务类别过滤,如 "LLM"、"Image"、"Code" |
| maxPrice | string | 否 | 最大单价(MON),如 "0.05" |
返回:{ services: [...], totalCount: number }
使用场景:用户问"有哪些 AI 服务可用"、"找一个图像生成服务"时调用。
执行方式:运行 scripts/run-tool.ts discover_services '{"category":"LLM"}'
agentxpay_pay_and_call (核心 Tool)用途:通过 x402 协议自动付费调用 AI 服务端点。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| url | string | 是 | AI 服务端点 URL |
| method | string | 否 | HTTP 方法,默认 "POST" |
| body | object | 否 | 请求体(会被 JSON 序列化) |
| headers | object | 否 | 额外 HTTP 请求头 |
返回:{ status, data, payment: { txHash, amount, serviceId }, latencyMs }
工作流程:
X-Payment-* 响应头X-Payment-TxHash 重新发送请求使用场景:用户说"帮我调用这个 AI 接口"、"用 GPT-4 回答问题"时调用。
执行方式:运行 scripts/run-tool.ts pay_and_call '{"url":"http://...","method":"POST","body":{"prompt":"hello"}}'
agentxpay_smart_call (推荐:一步到位)用途:智能发现 → 选择最优服务 → 自动付费调用,一步完成。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| task | string | 是 | 任务描述,如 "生成一张赛博朋克猫图片" |
| category | string | 否 | 偏好的服务类别 |
| maxBudget | string | 否 | 最大预算(MON) |
| preferCheapest | boolean | 否 | 是否优先选最便宜的 |
返回:{ selectedService: {...}, response, payment, latencyMs }
使用场景:用户描述一个需要外部 AI 服务的任务,但没有指定具体服务端点时。这是最常用的 Tool。
执行方式:运行 scripts/run-tool.ts smart_call '{"task":"生成赛博朋克猫图片","category":"Image"}'
agentxpay_manage_wallet用途:创建和管理 Agent 智能合约钱包,包括授权/撤销 Agent 地址和通过钱包余额支付服务。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| action | string | 是 | "create" / "fund" / "get_info" / "set_limit" / "authorize_agent" / "revoke_agent" / "pay" |
| dailyLimit | string | 条件 | 每日限额(MON),create/set_limit 时需要 |
| amount | string | 条件 | 金额(MON),fund/pay 时需要 |
| walletAddress | string | 条件 | 钱包地址,fund/get_info/set_limit/authorize_agent/revoke_agent/pay 时需要 |
| agentAddress | string | 条件 | Agent 地址,authorize_agent/revoke_agent 时需要 |
| serviceId | number | 条件 | 链上服务 ID,pay 时需要 |
返回:{ walletAddress, balance, dailyLimit, dailySpent, remainingAllowance, txHash, agentAddress?, isAuthorized?, paymentServiceId?, paymentAmount? }
Action 说明:
create:创建新的 Agent 智能钱包,设置每日支出限额fund:向钱包充值 MONget_info:查询钱包余额、每日限额、今日已花、剩余额度set_limit:调整每日支出限额authorize_agent:授权一个地址(Agent)从该钱包支出revoke_agent:撤销一个地址的钱包支出权限pay:通过钱包余额调用 PaymentManager.payPerUse 支付服务(需先授权)使用场景:用户说"创建一个 Agent 钱包"、"授权某个地址使用钱包"、"用钱包余额支付服务"时调用。
agentxpay_subscribe用途:订阅链上 AI 服务的周期性计划。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| serviceId | number | 是 | 链上服务 ID |
| planId | number | 否 | 订阅计划 ID(不传则自动选第一个) |
返回:{ subscriptionId, planName, price, txHash, hasAccess }
使用场景:用户说"订阅这个服务"、"我想包月使用"时调用。
agentxpay_create_escrow用途:为定制 AI 任务创建链上资金托管。
参数:
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| serviceId | number | 是 | 链上服务 ID |
| amount | string | 是 | 托管金额(MON) |
| deadlineDays | number | 是 | 截止天数 |
| description | string | 是 | 任务描述 |
返回:{ escrowId, amount, deadline, txHash }
使用场景:用户说"我有一个定制任务需要先锁定资金"时调用。
agentxpay_get_agent_info用途:查询当前 Agent 的钱包地址、余额和网络信息。
参数:无
返回:{ address, balance, network }
使用场景:用户问"我的钱包地址是什么"、"余额还有多少"时调用。
步骤 1: 调用 agentxpay_discover_services 查看可用服务和价格
步骤 2: 向用户展示服务列表和价格,确认是否继续
步骤 3: 用户确认后,调用 agentxpay_pay_and_call 或 agentxpay_smart_call
步骤 4: 返回 AI 服务响应 + 支付交易哈希
步骤 1: 调用 agentxpay_smart_call,传入任务描述和可选的类别/预算
步骤 2: Skill 自动发现服务 → 选择最优 → 付费调用
步骤 3: 返回结果给用户,附带所选服务信息和支付凭证
步骤 1: 调用 agentxpay_manage_wallet action="get_info" 查看当前状态
步骤 2: 根据需要执行 create/fund/set_limit
步骤 1: 创建钱包 — manage_wallet action="create" dailyLimit="1.0"
步骤 2: 充值 — manage_wallet action="fund" walletAddress="0x..." amount="10.0"
步骤 3: 授权 Agent — manage_wallet action="authorize_agent" walletAddress="0x..." agentAddress="0x..."
步骤 4: 通过钱包支付 — manage_wallet action="pay" walletAddress="0x..." serviceId=1 amount="0.01"
步骤 1: 调用 agentxpay_discover_services 找到目标服务
步骤 2: 调用 agentxpay_subscribe 订阅
步骤 3: 确认访问权限已激活
| 错误 | 原因 | 处理方式 |
|------|------|---------|
| "No matching services found" | 链上无匹配服务 | 建议用户放宽过滤条件或检查合约部署 |
| "insufficient funds" | Agent 余额不足 | 提示用户充值或使用 agentxpay_manage_wallet fund |
| "ServiceId mismatch" | 链上 serviceId 与 Provider 402 响应中的 serviceId 不一致 | 提示用户联系服务提供者修正 serviceId 配置 |
| "Price mismatch" | 链上 pricePerCall 与 Provider 402 响应中的 amount 不一致 | 提示用户联系服务提供者修正定价配置 |
| HTTP 402 retry 失败 | 支付验证未通过 | 检查合约地址和网络配置 |
| "daily limit exceeded" | 超出每日限额 | 提示用户调整限额或等待次日重置 |
| "Agent ... is not authorized" | Agent 未被授权使用钱包 | 用 authorize_agent 授权该 Agent |
| "Insufficient daily allowance" | 钱包每日额度不足 | 用 set_limit 调高限额或等待次日重置 |
| "Insufficient wallet balance" | 钱包余额不足 | 用 fund 向钱包充值 |
openclaw.json 安全注入,不要硬编码scripts/run-tool.ts(可直接 npx tsx 执行)src/types.tssrc/schemas.tssrc/runtime.tssrc/index.tsreferences/x402-protocol.mdreferences/sdk-api.mdGenerated Mar 1, 2026
An agency uses this skill to autonomously generate marketing copy, images, and code for clients by discovering and paying for various AI services on-chain. It streamlines workflows by automatically handling payments and service selection based on task descriptions, reducing manual intervention.
Researchers leverage the skill to access specialized AI models for data analysis, simulations, and language processing by paying per use via smart contracts. It enables transparent, on-chain billing and service discovery, fostering collaboration in open-source projects.
A business integrates the skill into its support bot to dynamically call external AI services for sentiment analysis, translation, or FAQ generation when needed. The bot manages wallet funds and subscriptions to optimize costs and ensure uninterrupted service.
The marketplace uses the skill to facilitate escrow payments for custom AI tasks, such as logo design or code review, by locking funds until completion. It automates service discovery and payment, enhancing trust and efficiency for freelancers and clients.
Act as an intermediary that charges a small fee on top of AI service payments made through the skill. Revenue is generated by facilitating transactions between users and service providers, leveraging the automated payment and discovery features.
Offer a bundled subscription plan that grants users access to multiple AI services via the skill's subscription tool. Manage relationships with service providers and handle on-chain payments, earning revenue from monthly subscription markups.
Provide managed wallet solutions for businesses using the skill's wallet management tools, including setup, funding, and authorization. Charge for consulting, maintenance, or premium features like advanced analytics on spending.
💬 Integration Tip
Ensure all required environment variables like RPC_URL and PRIVATE_KEY are securely configured before deployment to avoid runtime errors.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection