CtrlK
BlogDocsLog inGet started
Tessl Logo

alchemy-cli

Use the Alchemy CLI (`@alchemy/cli`) for live blockchain queries, admin, and on-machine automation across EVM JSON-RPC, Token, Transfers, Prices, Portfolio, Simulation, Solana RPC/DAS/gRPC, Sui gRPC, Webhooks, and app management. Preferred runtime path when CLI is installed locally. For NFT marketplace data, listings, or Seaport fulfillment, use `opensea-api` / `opensea-marketplace`. For shipped app code, use `alchemy-api` (with API key) or `alchemy-agentic-gateway` (without).

72

Quality

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

SKILL.md
Quality
Evals
Security

Alchemy CLI

Use the Alchemy CLI (@alchemy/cli) for live blockchain queries, admin work, and local automation from the terminal. The CLI maps every Alchemy product (Node JSON-RPC, Token, NFT, Transfers, Prices, Portfolio, Simulation, Solana, Webhooks, Apps) to alchemy <command> invocations with structured JSON output.

When to use this skill (scope_in)

Use alchemy-cli when all of the following are true:

  • The user wants live agent work — live querying, analysis, admin work, or local automation that the agent runs now in this session
  • @alchemy/cli is installed locally, or both the CLI and an MCP server are available, or neither is available (in which case install the CLI — see Install)

The CLI is the preferred local fallback runtime path for live agent work. When in doubt about CLI vs MCP, prefer the CLI.

When NOT to use this skill (scope_out, handoff)

SituationUse this skill instead
NFT/token data, search, collection statsopensea-api
Buy/sell NFTs, listings, offers, Seaport fulfillmentopensea-marketplace
ERC20 token swapsopensea-swaps
Wallet signing setupopensea-wallet
Build/register/gate AI agent toolsopensea-tool-sdk
MCP is already wired into your client and the CLI is not installed locallyalchemy-mcp
Building application code that runs outside this agent session, with an Alchemy API keyalchemy-api
Building application code without an API key, or as an autonomous agent that needs to pay for itself, or you explicitly want x402/MPPalchemy-agentic-gateway

Do not use this skill to write production application code — CLI commands are for live agent work, not for embedding into shipped software.

Install

npm i -g @alchemy/cli

If the CLI is not installed and the user wants live agent work, install it. Do not fall back to raw curl/HTTP calls — those are the API-key path covered by alchemy-api.

Bootstrap

Run this at the start of any session to get the full command contract (every command, flag, auth method, error code, and example):

alchemy --json --no-interactive agent-prompt

Execution rules

  • ALWAYS pass --json --no-interactive on every command
  • Parse stdout as JSON on exit code 0
  • Parse stderr as JSON on nonzero exit code
  • NEVER run bare alchemy without --json --no-interactive
  • NEVER use curl or raw HTTP when an alchemy CLI command exists for the task — that's the alchemy-api (API-key) path, not this skill
  • NEVER use the CLI to generate production application code; hand off to alchemy-api or alchemy-agentic-gateway for shipped code

Preflight

Before the first command, run both of these checks:

alchemy --json --no-interactive setup status
alchemy --json --no-interactive gas

setup status returns {"complete": true, "satisfiedBy": "<source>"} if any auth is configured. Do not rely on complete: true alone — there is a known false positive where setup status reports complete: true with satisfiedBy: "auth_token", but RPC commands still fail with AUTH_REQUIRED because no API key has been derived from the auth token.

gas is a lightweight RPC smoke test that catches this. If it returns {"gasPrice": "0x...", ...}, RPC is wired up correctly. If it returns {"error": {"code": "AUTH_REQUIRED", ...}}, run alchemy auth login (which fetches and saves the API key) or alchemy config set api-key <key>, then re-run gas to confirm.

If setup status reports complete: false, follow the nextCommands in the response first, then run gas to verify.

Auth setup

The fastest way to authenticate is via browser login:

alchemy auth login

This opens a browser to authenticate with your Alchemy account and automatically configures the CLI with your credentials.

To check auth status: alchemy auth status To log out: alchemy auth logout

Alternative auth methods

MethodConfig commandEnv varUsed by
Browser loginalchemy auth login--All commands (derives API key + access key from your account)
API keyalchemy config set api-key <key>ALCHEMY_API_KEYbalance, tx, receipt, block, gas, logs, rpc, trace, debug, tokens, nfts, transfers, prices, portfolio, simulate, bundler, gas-manager, solana
Access keyalchemy config set access-key <key>ALCHEMY_ACCESS_KEYapps (all subcommands incl. configured-networks)
Webhook keyalchemy config set webhook-api-key <key>ALCHEMY_WEBHOOK_API_KEYwebhooks
x402 walletalchemy wallet generate then alchemy config set x402 trueALCHEMY_WALLET_KEYbalance, tx, block, rpc, trace, debug, tokens, nfts, transfers

alchemy network list and alchemy version / update-check need no auth.

Selecting a default app

Many apps subcommands (and the access-key gated flows) operate on a "default app." If you see APP_REQUIRED in an error response, set one:

alchemy --json --no-interactive apps select <id>
# or equivalently
alchemy --json --no-interactive config set app <id>

Get API/access keys at dashboard.alchemy.com.

Task-to-command map

Node (EVM)

TaskCommand
ETH balancealchemy balance <address>
Transaction detailsalchemy tx <hash>
Transaction receiptalchemy receipt <hash>
Block detailsalchemy block <number|latest>
Gas pricesalchemy gas
Event logsalchemy logs --address <addr> --from-block <n> --to-block <n>
Raw JSON-RPCalchemy rpc <method> [params...]
Trace methodsalchemy trace <method> [params...]
Debug methodsalchemy debug <method> [params...]

Data

TaskCommand
ERC-20 balancesalchemy tokens balances <address>
ERC-20 balances (formatted)alchemy tokens balances <address> --metadata
Token metadataalchemy tokens metadata <contract>
Token allowancealchemy tokens allowance --owner <addr> --spender <addr> --contract <addr>
List owned NFTsalchemy nfts <address> [--limit <n>] [--page-key <key>]
NFT metadataalchemy nfts metadata --contract <addr> --token-id <id>
NFT contract metadataalchemy nfts contract <address>
Transfer historyalchemy transfers <address> --category erc20,erc721,erc1155,external,internal,specialnft [--from-block <n>] [--to-block <n>] [--max-count <n>] [--page-key <key>]
Spot prices by symbolalchemy prices symbol ETH,USDC
Spot prices by addressalchemy prices address --addresses '<json>'
Historical pricesalchemy prices historical --body '<json>'
Cross-network token portfolioalchemy portfolio tokens --body '<json>'
Token balances by address/network pairsalchemy portfolio token-balances --body '<json>'
Cross-network NFT portfolioalchemy portfolio nfts --body '<json>'
NFT contracts by address/network pairsalchemy portfolio nft-contracts --body '<json>'
Simulate single tx (asset deltas)alchemy simulate asset-changes --tx '<json>' [--block-tag <tag>]
Simulate single tx (execution trace)alchemy simulate execution --tx '<json>' [--block-tag <tag>]
Simulate bundle (asset deltas)alchemy simulate asset-changes-bundle --txs '<json-array>' [--block-tag <tag>]
Simulate bundle (execution trace)alchemy simulate execution-bundle --txs '<json-array>' [--block-tag <tag>]

Solana

TaskCommand
Solana JSON-RPCalchemy solana rpc <method> [params...]
Solana DAS (NFTs/assets)alchemy solana das <method> '<json>'

Webhooks

TaskCommand
List webhooksalchemy webhooks list
Create webhookalchemy webhooks create --body '<json>' [--dry-run]
Update webhookalchemy webhooks update --body '<json>' [--dry-run]
Delete webhookalchemy webhooks delete <id> [--yes] [--dry-run]
Get address-activity webhook addressesalchemy webhooks addresses <id>
Get NFT-activity webhook filtersalchemy webhooks nft-filters <id>

Account abstraction (ERC-4337)

TaskCommand
Send a UserOperationalchemy bundler send-user-operation --user-op '<json>' --entry-point <addr>
Estimate UserOperation gasalchemy bundler estimate-user-operation-gas --user-op '<json>' --entry-point <addr> [--state-override '<json>']
Get UserOperation receiptalchemy bundler get-user-operation-receipt --user-op-hash <hash>
Request gas + paymaster dataalchemy gas-manager request-gas-and-paymaster --body '<json>'
Request paymaster token quotealchemy gas-manager request-paymaster-token-quote --body '<json>'

Wallet (x402)

TaskCommand
Generate a new walletalchemy wallet generate
Import a wallet from a key filealchemy wallet import <path>
Show the locally configured wallet addressalchemy wallet address

App management

TaskCommand
List appsalchemy apps list [--cursor <c>] [--limit <n>] [--all] [--search <q>] [--id <appId>]
Get app detailsalchemy apps get <id>
Create appalchemy apps create --name "My App" --networks eth-mainnet [--description <desc>] [--products <ids>] [--dry-run]
Update app metadataalchemy apps update <id> --name "New Name" [--description <desc>] [--dry-run]
Update app network allowlistalchemy apps networks <id> --networks eth-mainnet,base-mainnet [--dry-run]
Update app address allowlistalchemy apps address-allowlist <id> --addresses 0xAA,0xBB [--dry-run]
Update app origin allowlistalchemy apps origin-allowlist <id> --origins https://a.com,https://b.com [--dry-run]
Update app IP allowlistalchemy apps ip-allowlist <id> --ips 1.2.3.4,5.6.7.8 [--dry-run]
Delete appalchemy apps delete <id> [--yes] [--dry-run]
Select default appalchemy apps select <id> (equivalent to alchemy config set app <id>)
List networks configured for an appalchemy apps configured-networks [--app-id <id>]
List Admin API chain identifiers (for apps create/update)alchemy apps chains
List all RPC network slugs (for --network)alchemy network list [--mainnet-only] [--testnet-only] [--search <term>]

CLI admin

TaskCommand
Check for CLI updatesalchemy update-check
View configalchemy config list
Reset configalchemy config reset --yes
CLI versionalchemy version

Global flags

FlagDescription
--jsonForce JSON output (auto-enabled when piped)
--no-interactiveDisable prompts and REPL
-n, --network <network>Target network (default: eth-mainnet, env: ALCHEMY_NETWORK)
--api-key <key>Override API key per command (env: ALCHEMY_API_KEY)
--access-key <key>Override access key per command (env: ALCHEMY_ACCESS_KEY)
--x402Use x402 wallet-based gateway auth for this command
--wallet-key-file <path>Path to wallet private key file (for x402)
--timeout <ms>Request timeout in milliseconds
-q, --quietSuppress non-essential output
--verboseLog request/response details to stderr
--debugEnable debug diagnostics
--no-colorDisable color output
--revealShow secrets in plain text (use with care; intended for explicit reveal flows)

Error handling

Errors return structured JSON on stderr. Each error has a code, an exitCode (1–9), a retryable boolean, and a recovery hint. Key codes (from agent-prompt):

CodeExitRetryableRecovery
AUTH_REQUIRED3NoRun alchemy auth login, or set ALCHEMY_API_KEY / alchemy config set api-key <key>
INVALID_API_KEY3NoCheck the API key; set a valid one with alchemy config set api-key <key>
ACCESS_KEY_REQUIRED3NoSet ALCHEMY_ACCESS_KEY or run alchemy config set access-key <key>
INVALID_ACCESS_KEY3NoCheck the access key at dashboard.alchemy.com
APP_REQUIRED3NoSelect a default app: alchemy apps select <id> (or alchemy config set app <id>)
NETWORK_NOT_ENABLED3NoEnable the target network for your app at dashboard.alchemy.com
SETUP_REQUIRED3NoRun alchemy --json setup status and follow nextCommands
PAYMENT_REQUIRED9NoFund x402 wallet or switch to API key auth
RATE_LIMITED5YesWait and retry with backoff; consider upgrading your plan
NETWORK_ERROR6YesCheck connection and retry
RPC_ERROR7NoCheck method, params, and network; verify API key has access
ADMIN_API_ERROR8NoCheck error message; verify access key permissions
NOT_FOUND4NoVerify the resource identifier (address, hash, id) is correct
INVALID_ARGS2NoCheck command usage via alchemy --json help <command>
INTERNAL_ERROR1NoUnexpected error; retry or report a bug

Get the full canonical list any time with alchemy --json --no-interactive agent-prompt.

Handing off to other skills

The user wants to...Hand off to
Wire Alchemy into application code that ships to production, with an API keyalchemy-api
Wire Alchemy into application code without an API key, or pay-per-request as an autonomous agentalchemy-agentic-gateway
Run live work but the CLI isn't installed and they prefer not to install it (MCP is wired in)alchemy-mcp

Bridging into the alchemy-api flow (extract an API key)

If the user is starting an app-code project and $ALCHEMY_API_KEY isn't set in their shell, use the CLI to fetch a key from their Alchemy account, persist it to the project's .env so it survives across terminal sessions, and export it for the current shell so the agent can use it immediately.

Security: NEVER echo, print, or otherwise surface the extracted API key value in conversation output. Refer to it only as $ALCHEMY_API_KEY after exporting. Treat it the same as a password.

# 1. Try to read a cached key from CLI config (read-only, safe non-interactive).
KEY="$(alchemy --no-interactive --json --reveal config get api-key 2>/dev/null | jq -r .value)"

# 2. If empty/null, run the interactive flow.
#    Note: auth login opens a browser and apps select shows a picker, so do NOT
#    pass --no-interactive here. If you already know the app id, pass it
#    explicitly to skip the picker: `alchemy --no-interactive --json apps select <id>`.
if [ -z "$KEY" ] || [ "$KEY" = "null" ]; then
  alchemy auth login              # opens browser; sets up account credentials
  alchemy --json apps select      # interactive picker (omit --no-interactive so it can render)
  KEY="$(alchemy --no-interactive --json --reveal config get api-key | jq -r .value)"
fi

# 3. Persist to the project's .env (standard practice — survives terminal restarts
#    and gets loaded by dotenv / framework env loaders at runtime).
#    Use .env.local if the project's framework expects that (e.g. Next.js).
ENV_FILE=".env"
touch "$ENV_FILE"
if grep -q '^ALCHEMY_API_KEY=' "$ENV_FILE"; then
  sed -i.bak "s|^ALCHEMY_API_KEY=.*|ALCHEMY_API_KEY=$KEY|" "$ENV_FILE" && rm "$ENV_FILE.bak"
else
  echo "ALCHEMY_API_KEY=$KEY" >> "$ENV_FILE"
fi
grep -qxF "$ENV_FILE" .gitignore 2>/dev/null || echo "$ENV_FILE" >> .gitignore

# 4. Export to the current shell so the agent can call the API immediately.
export ALCHEMY_API_KEY="$KEY"

Hand off to the alchemy-api skill once .env has the key and ALCHEMY_API_KEY is exported.

Official links

Repository
ProjectOpenSea/opensea-skill
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.