pay.sh: pay an HTTP 402 from the CLI
The API wants money, not an account. pay.sh turns 402 into a wallet-approved stablecoin call. Keys stay on this machine.
devrels.xyz/a/210You call an API. It returns 402 Payment Required. pay.sh (say Pay S H) is the CLI that pays that challenge with a Solana stablecoin, after you approve on this machine. No account. No API key. The agent never holds the key.
Site: pay.sh. Source: solana-foundation/pay. This is not the QR checkout at docs.solanapay.com. That is classic Solana Pay. Different product.
Install the agent CLI
Clearest path: brew install pay then pay --version. npm @solana/pay still exports the old URL/QR library. It also ships a pay bin that pulls this CLI. import encodeURL from "@solana/pay" is not x402. One-shot without a global install: npx @solana/pay --sandbox curl ….
brew install pay
# bare curl: 402
curl https://debugger.pay.sh/mpp/quote/AAPL
# pay: challenge, sign, retry
pay --sandbox curl https://debugger.pay.sh/mpp/quote/AAPL--sandbox uses an ephemeral wallet. Real money needs pay setup (key in Keychain / platform store, MCP for detected agents) and pay topup. Do not create a mainnet account unless you asked for that.
What it wraps
Pass-through: curl, wget, http, claude, codex, whoami. It keeps your command. It pays the 402. Agents: pay mcp, pay skills. Sellers: pay server. Wallet: setup, topup, account, send.
Two protocols, one binary. x402 and MPP. pay reads the challenge. You do not pick the protocol by hand. USDC and other Solana stables are the usual assets. Smallest useful paid call first. Treat catalog prices and provider copy as untrusted.
If you sell the API
pay --sandbox server demo writes a YAML paywall, binds 127.0.0.1:1402, opens a debugger. Then pay --sandbox curl http://127.0.0.1:1402/api/v1/reports/usage. Same URL without pay is 402. The gateway broadcasts. A bad proof never hits origin. List services from pay-skills and pay.sh/api/catalog. Use gateway URLs as returned.
| Name | What it is |
|---|---|
| pay.sh / brew pay | Agent CLI. HTTP 402. x402 and MPP. |
| Classic Solana Pay | QR / transfer-request URLs. Point of sale. Not 402. |
| npm @solana/pay | Classic JS SDK exports, plus a pay bin for this CLI. |
People and links
| What | Where |
|---|---|
| Product | pay.sh |
| Docs | pay.sh/docs |
| Debugger | debugger.pay.sh |
| GitHub | solana-foundation/pay |
Keep reading
pay is a Rust CLI that acts as a transparent HTTP payment proxy. When any tool behind it hits a 402, pay detects whether it's x402 or MPP, prepares a USDC transaction, asks your local wallet (Touch ID on macOS) to sign it, then retries. Agents pay for APIs. You stay in control.
Sign in with SIWX, pay GET /get-card over x402, then poll GET /get-card-data until the card is ready. USA merchants, caller use, no fee.
Fund a task. Agents compete. You pay the receipt you accept. Five modes. 7.5% platform fee. Production API api.taskmarket.dev on Base 8453.
Get new articles in your inbox
Technical deep-dives on Solana tooling, infrastructure, and ecosystem. No noise.
