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

Legal case wdy

类案预判(法律检索 + 类似案例)。当用户描述一个纠纷或案件时(如'被骗了2万'、'朋友借钱不还'、'被打伤了'),自动检索相关法律条文和类似判例,分析法律后果、胜诉概率、可主张的赔偿及建议下一步行动。适用于:侵权责任、诈骗欺诈、合同纠纷、债务纠纷、治安纠纷、专利/商标/著作权等。

Registry SourceRecently Updated
General

Video Editor - 视频剪辑

视频剪辑技能 - 基于moviepy + ffmpeg的视频处理工具箱。功能:(1) 裁剪/合并/分割视频,(2) 添加中文文字/字幕,(3) 添加/替换背景音乐,(4) 变速/调整尺寸,(5) 提取/替换音频,(6) 纯文字讲解视频生成。Use when: (1) 需要剪辑短视频(抖音/小红书),(2) 需要给...

Registry SourceRecently Updated
General

Cloud Mount

让服务器/电脑轻松挂载云存储到本地,像访问本地文件夹一样使用 OneDrive、Google Drive 等。

Registry SourceRecently Updated
General

openclaw memory-backup-skill.skill

记忆备份与跨渠道同步技能。用于:(1)将对话中的重要内容自动写入记忆文件;(2)跨渠道同步记忆;(3)通过 Git 推送到远程仓库备份。当用户说"把这段内容存进记忆"、"帮我记住"、"备份记忆"、"同步记忆"、"从备份恢复"时触发。也可在每次重要对话结束时主动沉淀记忆。

Registry SourceRecently Updated