Claude Code skills that let your AI agent discover, pay for, and call x402-gated APIs directly from the command line. Payment is handled via MetaMask in your browser — the agent never touches your private keys.
| Skill | Description |
|---|---|
| x402-hub | Browse the catalogue on an x402 Hub instance, inspect listings, and read usage docs. |
| x402-payment | Handle the full x402 payment flow — open a browser page for MetaMask signing, then retry the request with the signed payment header. |
npx skills add second-state/x402Once installed, Claude Code will automatically use the skills when you interact with x402-compatible APIs.
- Claude Code CLI installed
- MetaMask browser extension with a funded wallet
- For testnet usage: wallet connected to Base Sepolia (
eip155:84532) with testnet USDC
After installation, just talk to Claude Code naturally:
> What paid APIs are available on the x402 hub?
> Use the hub to compute 3 + 5
> Call https://x402-hub.secondstate.io/paid/demo-echo with POST body {"hello": "world"}
Claude Code will discover the right API, show you the price, open MetaMask for payment signing, and return the result.
- Discovery — The
x402-hubskill queries the hub's JSON API (/api/listings) to find and inspect available paid endpoints. - Payment — The
x402-paymentskill sends the request. If the server responds with HTTP 402, it opens a local browser page where you sign the payment with MetaMask. The signed header is attached and the request is retried automatically.
Apache-2.0