x402-cli

Pay for x402 payment-gated HTTP endpoints using USDC stablecoins

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "x402-cli" with this command: npx skills add razvanmacovei/x402-cli

x402-cli

Pay for x402 payment-gated HTTP endpoints using USDC stablecoins.

When to use

Use this tool when you need to access an API that returns HTTP 402 Payment Required with x402 payment requirements. The tool handles the full payment flow: probe → sign → pay → return response.

Prerequisites

Set EVM_PRIVATE_KEY environment variable with a wallet private key that holds USDC on the target network (e.g., Base Sepolia for testnet).

Usage

Probe an endpoint (check price without paying)

x402-cli --json --skip-verify <url>

Returns JSON with probe.paymentRequirements containing the price, network, and asset.

Pay and access an endpoint

x402-cli --json -y <url>

Returns JSON with payment.body containing the backend response and payment.paymentResponse containing the transaction hash.

POST with body

x402-cli --json -y -X POST -d '{"query": "hello"}' -H 'Content-Type: application/json' <url>

Self-signed TLS (local development)

x402-cli --json -y -k <url>

Exit codes

  • 0 — Success (payment accepted or probe completed)
  • 1 — Error (network, config, or unexpected failure)
  • 2 — Payment rejected by facilitator
  • 3 — Route is free (no payment needed)

JSON output structure

{
  "status": "accepted",
  "probe": {
    "statusCode": 402,
    "paymentRequired": true,
    "paymentRequirements": { "...x402 requirements..." }
  },
  "payment": {
    "statusCode": 200,
    "accepted": true,
    "signer": "0x...",
    "paymentResponse": { "success": true, "transaction": "0x...", "network": "eip155:84532" },
    "body": "...backend response..."
  }
}

Key fields to parse

  • .status"free", "payment_required", "accepted", "rejected", "error"
  • .probe.paymentRequirements.accepts[0].amount — price in atomic units
  • .probe.paymentRequirements.accepts[0].network — chain ID (e.g., eip155:84532)
  • .payment.body — the actual backend response after payment
  • .payment.paymentResponse.transaction — on-chain transaction hash

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

baidu-search

Comprehensive search API integration for Baidu Qianfan Web Search. Use when Claude needs to perform web searches using Baidu Qianfan's enterprise search API....

Registry SourceRecently Updated
General

Self Memory Manager

管理 Claude 的记忆和工作流程优化。包括:(1) Context 使用管理 (2) 重要信息存档 (3) 定时总结 (4) 工作文件夹维护 用于:context 超过 80%、重要信息需要记录、每日总结、清理旧 session

Registry SourceRecently Updated
General

Seedance Video

Generate AI videos using ByteDance Seedance. Use when the user wants to: (1) generate videos from text prompts, (2) generate videos from images (first frame,...

Registry SourceRecently Updated