Agnic Pay for Service

👤 agnicpay-prog 📦 v2.0.2 ⭐ 4.3 ⬇️ 632 下載
💻 開發程式設計 免費 🔑 需 API Key

📖 技能介紹

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 <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.

來源於7w4.net。

Workflow

  1. Check requirements (optional but recommended):

    npx agnic@latest x402 details <url>

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

  2. Verify balance:

    npx agnic@latest balance --network base
  3. Make the paid request:

    npx agnic@latest x402 pay <url> --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

🤖 AI 評測

這個 Skill 質量不錯,文件寫得很清楚,安全性也做得好,能有效防止輸入錯誤或惡意資料。功能方面覆蓋了付費 API 呼叫的完整流程,從檢查餘額到支付都有說明。不足之處是缺少一些常見問題的解答,遇到特殊情況可能不太好排查,整體中規中矩,對普通使用者來說夠用但不算特別友好。

📊 多維度評分

適應性4.8
規範性4.2
有效性4.2
可靠性4.3
可信度4.4

📁 包含檔案 (3 個)

📄 SKILL.md 2.5 KB
📄 _meta.json 143 B
📄 reference/x402-protocol.md 1.5 KB