$npx -y skills add moonpay/skills --skill alchemy-apiIntegrates Alchemy blockchain APIs using an API key. Requires $ALCHEMY_API_KEY to be set; if unavailable, use the alchemy-agentic-gateway skill instead. Use when user asks about EVM JSON-RPC calls, token balances, NFT ownership or metadata, transfer history, token prices, portfol
| 1 | # AI + Alchemy API Integration Guide |
| 2 | |
| 3 | ## Prerequisites |
| 4 | |
| 5 | 1. Create a free API key at https://dashboard.alchemy.com/ |
| 6 | 2. Export the key: `export ALCHEMY_API_KEY=<your-key>` |
| 7 | 3. If no API key is available, use the **alchemy-agentic-gateway** skill instead (wallet-based auth). |
| 8 | |
| 9 | ## Mandatory Routing Gate (Hard Requirement) |
| 10 | |
| 11 | Before the first network call or implementation step, you MUST ask the user the following question and wait for an explicit answer: |
| 12 | |
| 13 | > Do you want to use an existing Alchemy API key, or should I use the agentic gateway flow instead? |
| 14 | |
| 15 | If the user chooses the API key path, continue with this skill. |
| 16 | If the user chooses the agentic gateway path, switch to the `alchemy-agentic-gateway` skill immediately and follow its existing wallet flow. |
| 17 | If the user chooses the API key path but `ALCHEMY_API_KEY` is unset or empty, tell them they can create a free API key at https://dashboard.alchemy.com/ or switch to the `alchemy-agentic-gateway` skill. |
| 18 | |
| 19 | You MUST NOT call any keyless or public fallback (including `.../v2/demo`) unless the user explicitly asks for that endpoint. |
| 20 | Execute no network calls before this gate is evaluated. |
| 21 | |
| 22 | ## Base URLs + Auth (Cheat Sheet) |
| 23 | |
| 24 | | Product | Base URL | Auth | Notes | |
| 25 | | --- | --- | --- | --- | |
| 26 | | Ethereum RPC (HTTPS) | `https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | Standard EVM reads and writes. | |
| 27 | | Ethereum RPC (WSS) | `wss://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | Subscriptions and realtime. | |
| 28 | | Base RPC (HTTPS) | `https://base-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | EVM L2. | |
| 29 | | Arbitrum RPC (HTTPS) | `https://arb-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | EVM L2. | |
| 30 | | BNB RPC (HTTPS) | `https://bnb-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | EVM L1. | |
| 31 | | Solana RPC (HTTPS) | `https://solana-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY` | API key in URL | Solana JSON-RPC. | |
| 32 | | Solana Yellowstone gRPC | `https://solana-mainnet.g.alchemy.com` | `X-Token: $ALCHEMY_API_KEY` | gRPC streaming (Yellowstone). | |
| 33 | | NFT API | `https://<network>.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY` | API key in URL | NFT ownership and metadata. | |
| 34 | | Prices API | `https://api.g.alchemy.com/prices/v1/$ALCHEMY_API_KEY` | API key in URL | Prices by symbol or address. | |
| 35 | | Portfolio API | `https://api.g.alchemy.com/data/v1/$ALCHEMY_API_KEY` | API key in URL | Multi-chain wallet views. | |
| 36 | | Notify API | `https://dashboard.alchemy.com/api` | `X-Alchemy-Token: <ALCHEMY_NOTIFY_AUTH_TOKEN>` | Generate token in dashboard. | |
| 37 | |
| 38 | ## Endpoint Selector (Top Tasks) |
| 39 | |
| 40 | | You need | Use this | |
| 41 | | --- | --- | |
| 42 | | EVM read/write | JSON-RPC `eth_*` | |
| 43 | | Realtime events | `eth_subscribe` (WebSocket) | |
| 44 | | Token balances | `alchemy_getTokenBalances` | |
| 45 | | Token metadata | `alchemy_getTokenMetadata` | |
| 46 | | Transfers history | `alchemy_getAssetTransfers` | |
| 47 | | NFT ownership | `GET /getNFTsForOwner` | |
| 48 | | NFT metadata | `GET /getNFTMetadata` | |
| 49 | | Prices (spot) | `GET /tokens/by-symbol` | |
| 50 | | Prices (historical) | `POST /tokens/historical` | |
| 51 | | Portfolio (multi-chain) | `POST /assets/*/by-address` | |
| 52 | | Simulate tx | `alchemy_simulateAssetChanges` | |
| 53 | | Create webhook | `POST /create-webhook` | |
| 54 | | Solana NFT data | `getAssetsByOwner` (DAS) | |
| 55 | |
| 56 | Full reference: https://www.alchemy.com/docs |
| 57 | |
| 58 | ## One-File Quickstart (Copy/Paste) |
| 59 | |
| 60 | > **No API key?** Use the `alchemy-agentic-gateway` skill instead. |
| 61 | |
| 62 | ### EVM JSON-RPC (Read) |
| 63 | |
| 64 | ```bash |
| 65 | curl -s https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY \ |
| 66 | -H "Content-Type: application/json" \ |
| 67 | -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' |
| 68 | ``` |
| 69 | |
| 70 | ### Token Balances |
| 71 | |
| 72 | ```bash |
| 73 | curl -s https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY \ |
| 74 | -H "Content-Type: application/json" \ |
| 75 | -d '{"jsonrpc":"2.0","id":1,"method":"alchemy_getTokenBalances","params":["0x00000000219ab540356cbb839cbe05303d7705fa"]}' |
| 76 | ``` |
| 77 | |
| 78 | ### Transfer History |
| 79 | |
| 80 | ```bash |
| 81 | curl -s https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY \ |
| 82 | -H "Content-Type: application/json" \ |
| 83 | -d '{"jsonrpc":"2.0","id":1,"method":"alchemy_getAssetTransfers","params":[{"fromBlock":"0x0","toBlock":"latest","toAddress":"0x00000000219ab540356cbb839cbe05303d7705fa","category":["erc20"],"withMetadata":true,"maxCount":"0x3e8 |