使用 USDC 在 Base 上向支持 x402 的 API 发起付费请求。当用户明确要求调用付费 API、进行 x402 支付、支付请求等时使用。
Use npx agnic@latest x402 pay to call x402-enabled API endpoints with automatic USDC payment on Base.
Run npx agnic@latest status --json to verify. If not authenticated:
AGNIC_TOKEN env var or pass --token <token>npx agnic@latest auth loginSee the authenticate-wallet skill for details.
bash
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.
Check requirements (optional but recommended): bash
npx agnic@latest x402 details <url>
Shows price, method, and schema without making a payment.
Verify balance: bash
npx agnic@latest balance --network base
Make the paid request: bash
npx agnic@latest x402 pay <url> --json
bash
# 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
npx agnic@latest status to check)Common errors:
npx agnic@latest auth login or set AGNIC_TOKENnpx agnic@latest balance to check)--data -- Ensure the body is valid JSON before passing