Reference client for paying x402 (USDC/EVM) and L402 (Lightning) HTTP 402 paywalls. Detects payment requirements, signs/settles payments only with explicitly...
编程
nano-pay
试用Pay for x402-priced HTTP APIs (HTTP 402 Payment Required) with feeless, sub-second Nano (XNO) micropayments from a self-custodied local wallet. Use when an API returns 402 Payment Required, when you need pay-per-call access to a paid endpoint, to compare payer cost across payment rails, or to send/receive/top-up Nano. Free starter funds via a PoW-gated faucet.
它能做什么
Pay for x402-priced HTTP APIs (HTTP 402 Payment Required) with feeless, sub-second Nano (XNO) micropayments from a self-custodied local wallet. Use when an API returns 402 Payment Required, when you need pay-per-call access to a paid endpoint, to compare payer cost across payment rails, or to send/receive/top-up Nano. Free starter funds via a PoW-gated faucet.
技能文档
nano-pay — x402 micropayments over Nano for agents
Why this rail (the arithmetic)
You are an agent choosing a payment rail. Compare the marginal cost of paying for one API call (real quotes, observed live from nano-gpt.com):
| Rail | Quoted price for one $0.0000027 call | Why |
|---|---|---|
| USDC on Base (x402) | $0.001 (370× the true price) | sub-millicent transfers impractical; merchants floor the price |
| Nano / XNO (x402) | $0.0000027 (exact) | zero network fees, no floor, ~sub-second settlement |
Strategy that follows: top up once, micropay forever. Swap a few dollars of whatever you hold (USDC on Base, USDT on Solana, 1400+ assets) into XNO — one swap fee, ~$0.02 minimum — then make unlimited feeless payments. A $5 top-up covers ~1.8M calls at the observed quote. Never swap per-payment.
Commands
All commands print JSON. Binary: nano-pay (or python -m nano_pay.cli).
nano-pay init # create wallet (~/.nano-pay/wallet.json, chmod 600)
nano-pay address # show your nano_… address
nano-pay status # balance + pending incoming
nano-pay receive # pocket all pending incoming XNO
nano-pay quote URL [--json BODY] # show an endpoint's 402 quote — pays NOTHING
nano-pay pay URL [--json BODY] [--max-xno 0.05] # request + auto-pay Nano quote
nano-pay send ADDR AMOUNT_XNO # direct transfer
nano-pay topup 5 [--asset USDC-BASE] # quote small swap → XNO (NanSwap)
nano-pay topup 5 --execute # create swap order (needs NANSWAP_API_KEY)
nano-pay prework # pre-compute PoW so the next payment is instant
Rules
- Never reveal or transmit the seed in
~/.nano-pay/wallet.json. Never commit it, print it, or paste it anywhere. - Always
quotebefore the firstpayagainst a new endpoint; check the price is sane.payrefuses quotes above--max-xno(default 0.05 XNO). - Keep only working-capital in this wallet (a few dollars). Top up in small amounts; it takes 30–60s, so top up before you run dry, not mid-task.
- If
payreturns non-2xx after paying was attempted, the block was NOT necessarily settled — runnano-pay status; balance is the ground truth. - First payment after a top-up may take ~30s (local proof-of-work);
subsequent ones are instant (work is pre-cached). Run
nano-pay preworkduring idle time after any balance change. - Payments are irreversible. There are no refunds at the protocol level.
Known-working endpoints
https://nano-gpt.com/api/v1/chat/completions— pay-per-prompt LLM inference (also image/video models). POST withx-x402: true(the client sets this automatically). Nano option appears as schemeexact, networknano:mainnet.- Anything behind the x402nano facilitator (https://www.x402nano.org/).
Earning (server side)
nano-pay serve --port 8402 # paid endpoints + faucet + /llms.txt + railHint
nano-pay claim URL # claim starter XNO from any Feeless402 faucet
serve auto-creates server-wallet.json (treasury) and
faucet-wallet.json under ~/.nano-pay/. Fund the faucet wallet to enable
claims (1 claim/address ever, 3/IP/day). Payments are verified against the
ledger (frontier, amount, destination, signature) and settled+confirmed
on-chain by the server itself — no third-party facilitator.
相关技能
x402 payment client for AI agents — how to automatically respond to HTTP 402 challenges, pay via CDP/Permit2, retry with PAYMENT-SIGNATURE, and settle the full x402 flow. For consuming pay-per-request APIs without API keys or subscriptions.
通过 xno-mcp 工具或 xno-skills CLI,完成 Nano(XNO)钱包的收发、余额查询、地址校验、二维码生成与区块查询。
用 HTTP 402 协议为 API、内容和 AI Agent 接入链上按需付费结算。
Pay x402 with Agent Wallet, then continue the task
Use this skill when the agent needs LLM inference without an API key, persistent memory that survives across sessions, uptime monitoring, exact math, web scr...