Table of Contents
AI agents that query onchain data still hit the same wall: API keys, human dashboards, and prepaid CU plans that assume a person is signing up.
The named object is Alchemy x402 gateway auth: SIWE (Sign-In With Ethereum) from a local EVM wallet, HTTP 402 payment challenges settled in USDC on Base, and the Alchemy CLI (or agent skills) so an agent can call Node RPC, NFT, Portfolio, Transfers, Prices, and Simulation APIs without a classic API key. That is not Coinbase AgentKit paying a third-party x402 API, not Coinbase for Agents MCP/CLI wallet identity, not Circle's x402 facilitator product, and not Stripe Machine Payments Protocol (MPP).
Facts below come from Alchemy docs for Wallet auth for Alchemy APIs, the Alchemy CLI, and Alchemy's AI agents signup announcement as of September 26, 2026. Commands, flags, and payment rails are copied from those pages. No invented CU prices, undocumented chains, or unofficial facilitator URLs.
Key Takeaways
- Auth: SIWE from a local EVM wallet; payment: USDC on Base via x402 (Alchemy uses CDP facilitator).
- Enable with alchemy config set x402 true or the global --x402 flag on CLI calls.
- Minimum agent top-up starts at about $1 in compute credits per Alchemy's launch notes.
- Same APIs as key-based access: Node RPC across 100+ chains, NFT, Portfolio, Prices, Transfers, Simulation.
- Do not confuse alchemy config set x402 (pay Alchemy) with alchemy x402 request (pay third-party x402 APIs).
Who this is for
Use this path if you run agent workflows that need Alchemy-grade RPC and Data APIs, you can hold a small USDC balance on Base for top-ups, and you want wallet identity instead of rotating human API keys in cron or MCP sandboxes.
Skip it if you are accepting machine payments into Stripe (see How to Accept Stripe MPP Payments in USDC), paying arbitrary x402 merchants with AgentKit (see How to Pay for an x402 API with Coinbase AgentKit), standing up Coinbase's agent MCP/CLI surface (see How to Use Coinbase for Agents with MCP and CLI), or selling your own MCP tools (see How to Charge for MCP Tools with Cloudflare Agents x402). For funding patterns, see How to Fund an AI Agent Wallet with USDC.
What Alchemy x402 gateway auth means
Alchemy's agent gateway treats an EVM wallet as both identity and payment source. The agent signs a SIWE message, attaches that token to gateway requests, and when credits are required Alchemy returns HTTP 402 with payment instructions. The agent pays USDC on Base through x402. Alchemy documents that it uses Coinbase's CDP facilitator to verify and settle that payment, then serves the API response from the topped-up balance.
Subsequent calls draw down the balance until another 402 appears. Alchemy's February 26, 2026 launch post states agents can start with as little as $1 in compute credits (equivalent to $1 of CUs on the pay-as-you-go tier), with no contracts or human approval queue for that gateway path.
APIs available through the gateway match the key-based surface: Node RPC (standard eth_* plus Alchemy-enhanced methods across 100+ chains), Token, NFT, Transfers, Prices, Portfolio, and Simulation. The difference is authentication and settlement, not the data product.
Prerequisites
- Node.js with npm so you can install @alchemy/cli globally.
- A local EVM private key file (or generate one) that will hold USDC on Base for top-ups.
- Enough Base USDC to cover the first $1+ credit purchase and a buffer for retries.
- Optional: an AI coding agent that can install alchemyplatform/skills so the flow is machine-readable.
Step 1: Install the Alchemy CLI
Install the latest CLI, then confirm the binary responds:
npm i -g @alchemy/cli@latest alchemy version alchemy doctor
alchemy doctor and alchemy config status print remediation commands when wallet or network config is incomplete. Keep --json --no-interactive ready for agent runs so prompts never block.
Step 2: Connect a local EVM wallet for gateway auth
Gateway auth is local-wallet based. Connect in local mode, or point the CLI at an existing key file:
alchemy wallet connect --mode local # or import / point at a key file alchemy config set wallet-key-file /secure/path/evm.key # env alternative for agents export ALCHEMY_WALLET_KEY=0xYOUR_PRIVATE_KEY
You can also pass --wallet-key-file per command. Alchemy docs are explicit: the wallet used for x402 gateway auth only determines authentication and payment. Once authenticated, the agent can query any chain Alchemy supports through that gateway.
Step 3: Enable x402 gateway auth (not the third-party x402 client)
Turn on Alchemy's own gateway auth. This is alchemy config set x402 / the global --x402 flag. It is distinct from the alchemy x402 request command group, which pays compatible third-party x402 v2 APIs.
alchemy config set x402 true alchemy config get x402 # one-shot without persisting alchemy --x402 --json --no-interactive evm data price symbol ETH,BTC,SOL
If you still use browser login (alchemy auth) for Admin API app management, keep that separate. Gateway auth is the agent path that settles in USDC; account auth is the human developer path that binds an API key.
Step 4: Fund the wallet with USDC on Base
Alchemy settles gateway top-ups in USDC on Base at launch, with more chains called out as forthcoming in the announcement. Fund the same EVM address the CLI uses for SIWE. For general agent funding patterns, see How to Fund an AI Agent Wallet with USDC.
Operational checklist before the first paid call:
- Confirm the address on Base holds USDC (not only ETH).
- Keep a small ETH or sponsored-gas path if you also sign unrelated txs from the same key.
- Expect the first paid call to trigger a 402, settle, then succeed; subsequent calls reuse the credit balance.
- Cap agent spend outside Alchemy too (session limits, allowlists) so a runaway loop cannot drain the wallet.
Step 5: Run an agent-ready query
With x402 enabled and USDC available, exercise a Data API call in machine mode:
alchemy --json --no-interactive --x402 evm data balance vitalik.eth alchemy --json --no-interactive --x402 evm data price symbol ETH,BTC,SOL alchemy --json --no-interactive --x402 evm data nfts vitalik.eth --limit 5
For agents that need the full command tree, auth matrix, and error catalog, run alchemy --json --no-interactive agent-prompt and inject that JSON into the system prompt or skill. Pair with npx skills add alchemyplatform/skills --yes when the coding agent should learn the flow automatically.
Step 6: Optional MCP and skills wiring
Alchemy also ships an MCP server and Agent Skills for coding agents. The announcement documents:
npx skills add alchemyplatform/skills --yes # Claude Code claude mcp add alchemy --transport http https://mcp.alchemy.com/mcp # Codex codex mcp add alchemy --url https://mcp.alchemy.com/mcp
MCP is complementary: it is conversation-time querying. The CLI remains the shell/cron surface with explicit --x402 settlement. Product hub: alchemy.com/agents.
Operator pitfalls
- Mixing flags: config set x402 pays Alchemy; alchemy x402 request pays third parties. Wrong tool, wrong settlement story.
- Empty Base USDC balance: every paid call loops on 402 until the wallet is funded.
- Assuming Solana wallet auth: gateway auth is EVM + SIWE today.
- Storing ALCHEMY_WALLET_KEY in chat logs or public repos.
- Expecting Admin API app create/delete to work without alchemy auth browser/device login; gateway auth does not replace account auth for those admin surfaces.
| Surface | What it does | Stablecoin angle |
|---|---|---|
| x402 gateway auth (--x402 / config set x402) | SIWE + USDC top-ups to use Alchemy APIs | Pays Alchemy in USDC on Base |
| alchemy x402 request | Client for third-party x402 v2 APIs | Pays merchants; separate from gateway auth |
| alchemy auth / API key | Human developer account + app key | No USDC settlement for API access |
| Agent Wallet session (wallet connect --mode session) | Scoped signing session via dashboard | Signing path; not the same as gateway SIWE key |
When to use a facilitator how-to instead
If you are building a resource server that must verify and settle inbound x402 payments, you need facilitator selection, not Alchemy gateway auth. Start with How to Choose an x402 Facilitator for USDC and How to Enable Circle x402 Facilitator for USDC. Alchemy's gateway documents CDP facilitator on the payment side of its own credit top-ups; that does not make Alchemy your merchant facilitator.
FAQ
How do AI agents authenticate to Alchemy APIs with USDC?
Agents use Alchemy x402 gateway auth: an EVM wallet signs SIWE for identity, Alchemy returns HTTP 402 when credits are needed, and the agent pays USDC on Base before the CLI retries the request.
What is the difference between Alchemy x402 gateway auth and alchemy x402 request?
Gateway auth (config set x402 / --x402) pays Alchemy for its own APIs. alchemy x402 request pays compatible third-party x402 v2 endpoints. Alchemy documents them as distinct CLI surfaces.
Which chains can agents query after paying with x402?
Once gateway auth succeeds, agents can query across the networks Alchemy supports through that gateway (100+ chains for Node RPC and related Data APIs). Settlement for top-ups at launch is USDC on Base.
How much USDC do agents need to start?
Alchemy's launch post states agents can start with as little as $1 in compute credits, equivalent to $1 of CUs on the pay-as-you-go tier. Keep a buffer for retries and concurrent workflows.
Do agents still need alchemy auth browser login?
Not for gateway-paid data queries. Browser or device-code alchemy auth remains the path for Admin API app management and key-backed developer workflows. Keep those concerns separate in runbooks.
Can a Solana wallet authenticate Alchemy x402 gateway auth?
Not today for gateway auth. Alchemy docs state x402 gateway authentication currently uses an EVM wallet and SIWE. Solana wallets in the CLI are for Solana transaction signing.
Is this the same as Coinbase AgentKit x402 payments?
No. AgentKit is a general client stack for paying third-party x402 APIs. Alchemy x402 gateway auth is specifically how agents pay Alchemy for RPC and Data APIs with USDC.
Where should operators read the primary docs?
Start with Wallet auth for Alchemy APIs, the Alchemy CLI reference, and the AI agents signup post. Product hub: alchemy.com/agents.
This content is provided for informational and educational purposes only and does not constitute financial, investment, legal, or tax advice; no material herein should be interpreted as a recommendation, endorsement, or solicitation to buy or sell.