Skip to main content
With the metal-agent CLI you create the agent’s key, fund it, and make a paid request over x402 to Metal’s demo seller, which charges 0.01 *USDZ for GET /quote.

1. Install the CLI

2. Create the agent’s key

This is the agent’s own key, and the address is where it pays from. The key file holds the private key in the clear, so treat it as the secret. If the key file already exists, key create keeps it and answers that it already holds a key; its address field is the address.

3. Fund the key

Sign in to the Metal console, the same sign-in that gives you an RPC endpoint, then open Faucet and fund the address. Each grant tops it up to 100 *USDZ, and grants are limited per user. Without a sign-in, ask the public faucet:
Pass --network testnet to every command that touches the chain. The public faucet grants each IP address ten times a UTC day, once a minute, so everyone behind one address shares them, out of 1,000 grants a day for every client, the Console included. If it refuses, you get the reason and what to do next. The Console’s Faucet page uses the same faucet: when the faucet is down, retry later.

4. Pay

Response headers the seller sends appear as header <name>: <value> lines before body, except those pay hides, such as content-type and date. The facilitator submitted the transfer and paid the gas. A payment it refuses exits with its reason. pay caps a purchase at 1 *USDZ by default; pass --max <usdz> to raise it for one command. To let an agent pay from your Metal account within limits it cannot change, see Mandates.

5. Check the settlement

Open the explorer URL to see the settlement, or use status with an endpoint of your own:

Pay from code

To make the same payment from TypeScript, use createMetalPaymentClient from @metalntwx/metal-pay. The same 1 *USDZ cap applies unless you set maxAmount. Set AGENT_PRIVATE_KEY to the privateKey field of the key file:

Accept agent payments

The seller’s side: a route that charges for this agent’s requests.

Facilitator

Endpoints, limits, refusal reasons and retries.