/install agnicpay-pay-for-service
Paying for x402 Services
Use npx agnic@latest x402 pay to call x402-enabled API endpoints with automatic USDC payment on Base.
Authentication
Run npx agnic@latest status --json to verify. If not authenticated:
- Headless (CI/server/agent): Set
AGNIC_TOKENenv var or pass--token \x3Ctoken> - Interactive (has browser): Run
npx agnic@latest auth login
See the authenticate-wallet skill for details.
Command Syntax
npx agnic@latest x402 pay \x3Curl> [-X \x3Cmethod>] [-d \x3Cjson>] [-q \x3Cparams>] [-h \x3Cjson>] [--max-amount \x3Cn>] [--json]
See reference/x402-protocol.md for full options, USDC amounts, and input validation rules.
Workflow
-
Check requirements (optional but recommended):
npx agnic@latest x402 details \x3Curl>Shows price, method, and schema without making a payment.
-
Verify balance:
npx agnic@latest balance --network base -
Make the paid request:
npx agnic@latest x402 pay \x3Curl> --json
Examples
# GET request (auto-pays)
npx agnic@latest x402 pay https://example.com/api/weather --json
# POST request with body
npx agnic@latest x402 pay https://example.com/api/sentiment -X POST -d '{"text": "I love this product"}' --json
# Limit max payment to $0.10
npx agnic@latest x402 pay https://example.com/api/data --max-amount 100000 --json
Prerequisites
- Must be authenticated (
npx agnic@latest statusto check) - Wallet must have sufficient USDC balance on Base
Error Handling
Common errors:
- "Not authenticated" -- Run
npx agnic@latest auth loginor setAGNIC_TOKEN - "Insufficient balance" -- Fund wallet with USDC (
npx agnic@latest balanceto check) - "No X402 payment requirements found" -- URL may not be an x402 endpoint
- Invalid JSON in
--data-- Ensure the body is valid JSON before passing - HTTP 4xx/5xx from the API -- Show the status code and response body to the user
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install agnicpay-pay-for-service - 安装完成后,直接呼叫该 Skill 的名称或使用
/agnicpay-pay-for-service触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Agnic Pay for Service 是什么?
Make paid requests to x402-enabled APIs using USDC on Base. Use when the user explicitly asks to call a paid API, make an x402 payment, pay for a request, or... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 104 次。
如何安装 Agnic Pay for Service?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install agnicpay-pay-for-service」即可一键安装,无需额外配置。
Agnic Pay for Service 是免费的吗?
是的,Agnic Pay for Service 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Agnic Pay for Service 支持哪些平台?
Agnic Pay for Service 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Agnic Pay for Service?
由 Agnic.AI(@agnicpay-prog)开发并维护,当前版本 v2.0.2。