← 返回
未分类 Key 中文

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...
使用 USDC 在 Base 上向支持 x402 的 API 发起付费请求。当用户明确要求调用付费 API、进行 x402 支付、支付请求等时使用。
agnicpay-prog agnicpay-prog 来源
未分类 clawhub v2.0.2 1 版本 100000 Key: 需要
★ 0
Stars
📥 341
下载
💾 0
安装
1
版本
#latest

概述

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_TOKEN env var or pass --token
  • Interactive (has browser): Run npx agnic@latest auth login

See the authenticate-wallet skill for details.

Command Syntax

npx agnic@latest x402 pay <url> [-X <method>] [-d <json>] [-q <params>] [-h <json>] [--max-amount <n>] [--json]

See reference/x402-protocol.md for full options, USDC amounts, and input validation rules.

Workflow

  1. Check requirements (optional but recommended):

```bash

npx agnic@latest x402 details

```

Shows price, method, and schema without making a payment.

  1. Verify balance:

```bash

npx agnic@latest balance --network base

```

  1. Make the paid request:

```bash

npx agnic@latest x402 pay --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 status to check)
  • Wallet must have sufficient USDC balance on Base

Error Handling

Common errors:

  • "Not authenticated" -- Run npx agnic@latest auth login or set AGNIC_TOKEN
  • "Insufficient balance" -- Fund wallet with USDC (npx agnic@latest balance to 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

版本历史

共 1 个版本

  • v2.0.2 当前
    2026-05-07 10:38 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 326,486
it-ops-security

Agnic Authenticate Wallet (x402)

agnicpay-prog
通过浏览器OAuth或无头API令牌认证Agnic钱包。用于登录、身份验证、连接钱包、CLI配置等场景。
★ 0 📥 628
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,596