返回顶部
p

pay-for-service按服务付费

Make a paid API request to an x402 endpoint with automatic USDC payment. Use when you or the user want to call a paid API, make an x402 request, use a paid service, or pay for an API call. Use after finding a service with search-for-service.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.0
安全检测
已通过
868
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

pay-for-service

技能名称: pay-for-service
详细描述:

发起付费 x402 请求

使用 npx awal@latest x402 pay 命令调用付费 API 端点,并通过 Base 网络自动完成 USDC 支付。

确认钱包已初始化并认证

bash
npx awal@latest status

如果钱包未认证,请参考 authenticate-wallet 技能。

命令语法

bash
npx awal@latest x402 pay [-X ] [-d ] [-q ] [-h ] [--max-amount ] [--json]

选项

选项描述
-X, --method <method>HTTP 方法(默认:GET)
-d, --data <json>
请求体,JSON 字符串格式 | | -q, --query | 查询参数,JSON 字符串格式 | | -h, --headers | 自定义 HTTP 请求头,JSON 字符串格式 | | --max-amount | 最大支付金额,USDC 原子单位(1000000 = $1.00) | | --correlation-id | 对相关操作进行分组 | | --json | 以 JSON 格式输出 |

USDC 金额

X402 使用 USDC 原子单位(6 位小数):

原子单位美元
1000000$1.00
100000
$0.10 |
| 50000 | $0.05 |
| 10000 | $0.01 |

重要提示:对于包含 $ 的金额,务必使用单引号包裹,以防止 bash 变量展开(例如使用 $1.00 而非 $1.00)。

示例

bash

发起 GET 请求(自动支付)


npx awal@latest x402 pay https://example.com/api/weather

发起带请求体的 POST 请求

npx awal@latest x402 pay https://example.com/api/sentiment -X POST -d {text: I love this product}

限制最大支付金额为 $0.10

npx awal@latest x402 pay https://example.com/api/data --max-amount 100000

前置条件

  • - 必须完成认证(使用 npx awal@latest status 检查,详见 authenticate-wallet 技能)
  • 钱包必须有足够的 USDC 余额(使用 npx awal@latest balance 检查)
  • 如果不知道端点 URL,请先使用 search-for-service 技能查找服务

错误处理

  • - Not authenticated(未认证) - 请先运行 awal auth login ,或参考 authenticate-wallet 技能
  • No X402 payment requirements found(未找到 X402 支付要求) - 该 URL 可能不是 x402 端点;请使用 search-for-service 查找有效端点
  • Insufficient balance(余额不足) - 请向钱包充值 USDC;详见 fund 技能

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 pay-for-service-1776187395 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 pay-for-service-1776187395 技能

通过命令行安装

skillhub install pay-for-service-1776187395

下载

⬇ 下载 pay-for-service v0.1.0(免费)

文件大小: 1.79 KB | 发布时间: 2026-4-15 10:44

v0.1.0 最新 2026-4-15 10:44
Initial release of pay-for-service skill.

- Enables making paid API requests to x402 endpoints with automatic USDC payment on Base.
- Provides command syntax and usage for npx awal@latest x402 pay.
- Documents options for HTTP method, headers, data, query params, and max payment amount.
- Outlines prerequisites: wallet authentication and sufficient USDC balance.
- Includes usage examples and common error handling steps.
- Designed to be used after discovering services via search-for-service.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部