x402-cli
Pay for x402 payment-gated HTTP endpoints using USDC stablecoins
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-11
- Stars
- ★ 80
- Forks
- 17
01 前言 Front Matter
- name
- x402-cli
- version
- 1.0.3
- metadata
- { "openclaw": { "install": [ { "bins": [ "x402-cli" ], "kind": "brew", "formula": "razvanmacovei/tap/x402-cli" }, { "bins": [ "x402-cli" ], "kind": "go", "package": "github.com/razvanmacovei/x402-cli@latest" } ], "homepage": "https://github.com/razvanmacovei/x402-cli", "requires": { "env": [ "EVM_PRIVATE_KEY" ], "bins": [ "x402-cli" ] }, "primaryEnv": "EVM_PRIVATE_KEY" } }
- description
- Pay for x402 payment-gated HTTP endpoints using USDC stablecoins
02 资源文件 4
- 参考文档_meta.json275 B
- 参考文档clawhub.json1.3 KB
- 参考文档SOURCE.md250 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
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 facilitator3— 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
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.