Skip to content
Alchemy Logo

Agent Authentication and Payment

Authenticate your AI agent with an EVM wallet instead of an API key using SIWE. Your agent can pay with USDC through the x402 payment protocol.

x402 wallet authentication in the Alchemy CLI uses two open standards today:

  • SIWE (Sign-In With Ethereum): Your agent authenticates by signing a message with an EVM wallet.
  • x402: An open protocol for HTTP-native payments. When payment is required, the server responds with HTTP 402, the CLI signs the payment challenge with the same EVM wallet, and retries the request. Zero protocol fees.

The CLI also supports local Solana wallets for Solana transaction signing, but x402 gateway authentication currently uses an EVM wallet and SIWE.

When your agent needs to access Alchemy APIs without an API key, it handles the full wallet authentication flow:

  1. Wallet setup: Your agent creates a local EVM wallet or imports an existing EVM private key.
  2. Authentication: Your agent generates a signed SIWE token and includes it in every x402 gateway request.
  3. Payment: When payment is required, the server responds with HTTP 402, and your agent signs the requested USDC payment before retrying automatically.

The x402 wallet only determines authentication and payment. Once authenticated, it can query any chain across all networks Alchemy supports.

All standard Alchemy APIs are available through the x402 gateway:

  • Node RPC: Standard Ethereum JSON-RPC methods (eth_*) plus Alchemy-enhanced methods, across 100+ chains
  • Token API: Token balances, metadata, and allowances
  • NFT API: NFT ownership, metadata, sales, and spam detection
  • Transfers API: Asset transfer history with filtering
  • Prices API: Spot and historical token prices
  • Portfolio API: Multi-chain balances and portfolio data
  • Simulation API: Transaction simulation and outcome prediction

These are the same APIs available with a standard API key. The only difference is the authentication and payment mechanism.

EVM walletSolana wallet
CLI usex402 gateway auth and EVM transaction signingSolana transaction signing
Auth standardSIWE (EIP-4361)Not used for x402 in the CLI today
Signaturesecp256k1ed25519
PaymentUSDC through x402 payment challengesNot used for x402 in the CLI today
Queryable chains through x402All supported networksNot applicable

Install the agentic-gateway agent skill so your AI coding agent learns this flow automatically:

npx skills add alchemyplatform/skills --yes

Your agent will walk you through wallet setup and handle authentication and payments from there.

The Alchemy CLI ships the x402 flow built in. Create or import a local EVM wallet, opt into x402, and node and data commands can authenticate and pay from that wallet without an API key.

alchemy wallet connect --mode local --chain evm
alchemy config set x402 true
alchemy evm data balance vitalik.eth

You can also point at an existing EVM private key file with alchemy config set wallet-key-file <path>, pass --wallet-key-file <path>, or set ALCHEMY_WALLET_KEY.

Was this page helpful?