x402s brings off-chain micropayments to the agentic web. Agent-to-API. Agent-to-agent. State channels replace on-chain transactions — pay with signed state, not gas.
Every on-chain tx costs gas, time, and complexity. State channels move payment off-chain. Settle only when you need to.
Payments are signed channel state updates. No blocks to wait for. Pay and respond in one round-trip.
Dispute contract enforces honest settlement. Challenge watcher catches stale closes. Funds always recoverable.
APIs return 402 with offers. Agents retry with payment proof. Standard headers, no custom transport.
Payment state stays off-chain between participants. No public transaction leakage during API traffic.
One channel to a hub unlocks every connected payee. Pay many APIs from a single funded channel.
USDC, ETH, any ERC-20. Per-path pricing in human units. Payees set offers, agents pick what they hold.
Built for autonomous agents. Auto, per-payment, or per-API approval modes. CLI + SDK + HTTP server.
Ships a ready-made skill folder. Drop it into Claude or any LLM agent for automatic 402 handling.
MIT licensed. No transaction fees, no lock-in. Run your own hub or use a public one. Fork it, ship it.
From 402 response to 200. The full payment lifecycle.
Agent GETs a resource. Payee returns 402 with accepted payment offers: networks, assets, prices, route modes.
Agent sends offer to hub. Hub calculates fee, returns a quote with a payment draft ready to sign.
Agent signs channel state update. Hub validates, co-signs, returns a ticket: the payment proof.
Agent retries with PAYMENT-SIGNATURE header. Payee verifies ticket, returns 200 + receipt.
Any agent can be both payer and payee. The hub routes payments between them — no direct channel required.
Agent 1 needs market data. Agent 2 has a crawl pipeline. A₁ pays A₂ per-query through the hub. No API registration — just a 402 endpoint.
A coding agent hits a limit. It discovers a specialized model agent advertising inference via 402. Pay per call, get structured output back.
An orchestrator fans out tasks to specialist agents. Each sub-agent bills for its work. The hub settles all flows from one channel.
An agent posts a task with a price. The first agent to return a valid result gets paid instantly — verified by the hub, no escrow contract needed.
Install, configure, open a channel, and pay. The wizard handles setup; you handle the API calls.
Return HTTP 402 with offers when unpaid, then verify the payment signature and serve data with a receipt.
Most users only need the agent. Build paid APIs or run hub infra when you're ready.
Discover offers, open channels, pay APIs. Auto-mode handles everything; manual mode gives you control.
npm run scp:agent:pay -- <url>
Protect routes with 402, define per-path pricing in JSON, validate tickets. Template included.
npm run scp:payee
Quote fees, issue tickets, track settlements. Scale with Redis + cluster mode for production.
npm run scp:hub
Install, open a channel, pay. The wizard handles setup — deploy on Sepolia, Base, or any EVM chain.