Logo Alchemy Cli

Alchemy Cli

Tổ chức
alchemyplatform
alchemy-cli

Dùng Alchemy CLI (`@alchemy/cli`) để truy xuất dữ liệu blockchain trực tiếp, tra cứu giao dịch, truy vấn NFT/token/danh mục đầu tư, mô phỏng, truy vết/gỡ lỗi, đọc/ghi hợp đồng, gửi giao dịch có chữ ký ví, hoán đổi và bắc cầu xuyên chuỗi, Solana RPC/DAS cùng thao tác gửi từ ví, quản lý webhook và quản trị ứng dụng Alchemy. Đây là lộ trình ưu tiên khi tác nhân cần hoạt động trực tiếp (truy vấn, quản trị, tự động hóa cục bộ) nếu CLI đã được cài đặt cục bộ — hoặc khi có cả CLI lẫn MCP. Nếu chưa cài cả hai, hãy cài CLI bằng `npm i -g @alchemy/cli`. Dùng cho tác vụ trực tiếp của tác nhân trong phiên này, không dùng để xây dựng mã ứng dụng phát hành lên môi trường production. Với mã ứng dụng, dùng kỹ năng `alchemy-api` (có khóa API) hoặc kỹ năng `agentic-gateway` (không có khóa API).

Tổng quan

Nhà phát hànhalchemyplatform
Kho mãskills
Tên kỹ năngalchemy-cli
Sao
55
Bản fork
26
Tệp đi kèm
1
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được alchemyplatform công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Alchemy Cli trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/alchemyplatform/skills/tree/main/plugins/alchemy/skills/alchemy-cli
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alchemyplatform/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/plugins/alchemy/skills/alchemy-cli .claude/skills/alchemy-cli
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Alchemy Cli trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Alchemy Cli ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Alchemy Cli với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Alchemy CLI

Use the Alchemy CLI (@alchemy/cli) for live blockchain queries, admin work, transaction signing, and local automation from the terminal. The CLI groups commands by chain (evm, solana, xchain) and by product area (wallet, app, webhook, auth, config), each with structured JSON output.

When to use this skill

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 to use a different skill

SituationUse this skill instead
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/MPPagentic-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

bash
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):

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

For wallet-scoped agent work, use the narrower contract that lists only wallet, EVM, Solana, and cross-chain commands plus the session-signer capability set:

bash
alchemy --json --no-interactive agent-prompt --scope wallet

When the CLI is not installed yet but the agent needs the same contract, the unauthenticated npx variant works:

bash
npx -y @alchemy/cli@latest --json --no-interactive agent-prompt --scope wallet

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 agentic-gateway for shipped code
  • For onchain actions (evm send, evm contract call, evm approve, evm swap, xchain bridge, solana send), run alchemy --json --no-interactive wallet status --verify first to confirm the session is still valid, then prefer --dry-run before broadcast. Treat sponsorship policies (--gas-policy-id, --fee-policy-id) as fee controls, not wallet spend limits.

Preflight

Before the first command, run both of these checks:

bash
alchemy --json --no-interactive doctor
alchemy --json --no-interactive evm gas

doctor (alias: alchemy config status) reports what's configured plus a nextCommands list of remediation steps. Do not rely on its top-level OK alone — there is a known false positive where it reports the session is set up but RPC commands still fail with AUTH_REQUIRED because no API key has been derived from the auth token.

evm 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 evm gas to confirm.

If doctor reports missing config, follow its nextCommands first, then run evm gas to verify.

Auth setup

The fastest way to authenticate is via browser login:

bash
alchemy auth login

For headless environments (SSH, GitHub Codespaces, CI, sandboxes) where the browser can't reach the CLI's localhost callback, force the OAuth 2.0 Device Authorization Grant flow:

bash
alchemy auth login --device-code

Plain alchemy auth auto-detects non-interactive sessions and switches to device-code mode automatically. Requires @alchemy/cli 0.18.0 or later.

This opens a browser, completes the OAuth flow, and configures both the API key (for RPC/Data) and the Admin API access internally. There is no separate access key step anymore — admin commands (alchemy app ...) work straight after alchemy auth login.

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

Alternative auth methods

MethodConfig commandEnv varUsed by
Browser loginalchemy auth login (add --device-code for headless)--All commands (covers both RPC/Data and Admin)
API keyalchemy config set api-key <key>ALCHEMY_API_KEYRPC/Data commands (evm rpc, evm data, evm tx, solana rpc, etc.)
Webhook keyalchemy config set webhook-api-key <key>ALCHEMY_WEBHOOK_API_KEYwebhook
Agent wallet sessionalchemy wallet connect --mode session --instance-name <label> (approve in dashboard)--evm send, evm contract call, evm approve, evm swap, xchain bridge, evm status, solana send, solana status, solana delegate
Local walletalchemy wallet connect --mode local (--import <path> for EVM key)--Same wallet-signed commands as session, with --signer local override
x402 gateway auth (Alchemy API path)alchemy wallet connect --mode local --chain evm then alchemy config set x402 trueALCHEMY_WALLET_KEYRPC and Data commands when --x402 is active. This is Alchemy API auth via wallet, distinct from alchemy x402 request (see below).
x402 payments (third-party APIs)alchemy wallet connect --mode local — a signer configured for x402 payments--alchemy x402 request <url>, alchemy x402 balance (pays third-party APIs in USDC per RFC 402)

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

Selecting a default app

Many app subcommands operate on a "default app." If you see APP_REQUIRED in an error response, select one:

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

Get an Alchemy account at dashboard.alchemy.com.

Task-to-command map

EVM — onchain reads

TaskCommand
Native balance (ETH, MATIC, ...)alchemy evm data balance <address>
Transaction detailsalchemy evm tx <hash>
Transaction receiptalchemy evm receipt <hash>
Block detailsalchemy evm block <number|latest>
Gas pricesalchemy evm gas
Event logsalchemy evm logs --address <addr> --from-block <n> --to-block <n>
Raw JSON-RPCalchemy evm rpc <method> [params...]
Trace methodsalchemy evm trace <method> [params...]
Debug methodsalchemy evm debug <method> [params...]
Contract view/pure callalchemy evm contract read <address> <function> [--args ...] [--abi-file <path>]

EVM — Data API

TaskCommand
ERC-20 balancesalchemy evm data tokens balances <address>
ERC-20 balances (formatted)alchemy evm data tokens balances <address> --metadata
Token metadataalchemy evm data tokens metadata <contract>
Token allowancealchemy evm data tokens allowance --owner <addr> --spender <addr> --contract <addr>
List owned NFTsalchemy evm data nfts <address> [--limit <n>] [--page-key <key>]
NFT metadataalchemy evm data nfts metadata --contract <addr> --token-id <id>
NFT contract metadataalchemy evm data nfts contract <address>
Asset transfer historyalchemy evm data history <address> [--from-block <n>] [--to-block <n>] [--max-count <n>] [--page-key <key>]
Spot prices by symbolalchemy evm data price symbol ETH,USDC
Spot prices by addressalchemy evm data price address --addresses '<json>'
Historical pricesalchemy evm data price historical --body '<json>'
Cross-network token portfolioalchemy evm data portfolio tokens --body '<json>'
Token balances by address/network pairsalchemy evm data portfolio token-balances --body '<json>'
Cross-network NFT portfolioalchemy evm data portfolio nfts --body '<json>'
NFT contracts by address/network pairsalchemy evm data portfolio nft-contracts --body '<json>'

EVM — Simulation

TaskCommand
Simulate single tx (asset deltas)alchemy evm simulate asset-changes --tx '<json>' [--block-tag <tag>]
Simulate single tx (execution trace)alchemy evm simulate execution --tx '<json>' [--block-tag <tag>]
Simulate bundle (asset deltas)alchemy evm simulate asset-changes-bundle --txs '<json-array>' [--block-tag <tag>]
Simulate bundle (execution trace)alchemy evm simulate execution-bundle --txs '<json-array>' [--block-tag <tag>]

EVM — wallet-signed transactions

Wallet-signed EVM actions return a smart wallet call ID. Use alchemy evm status <call-id-or-tx-hash> to check either value. Use --gas-sponsored and --gas-policy-id <id> on supported actions to request gas sponsorship; set defaults with alchemy config set evm-gas-sponsored true and alchemy config set evm-gas-policy-id <id>.

TaskCommand
Send native tokenalchemy evm send <to> <amount> [-n <network>]
Send ERC-20alchemy evm send <to> <amount> --token <token-address>
Execute a contract functionalchemy evm contract call <address> <function> [--args ...] [--abi-file <path>|--abi '<json>'] [--value <wei>]
Approve / revoke / reset ERC-20 allowancealchemy evm approve <spender-address> --token-address <addr> [--amount <n>|--unlimited|--revoke]
Quote same-chain swapalchemy evm swap quote --from <token> --to <token> --amount <n>
Execute same-chain swapalchemy evm swap execute --from <token> --to <token> --amount <n>
Check call / tx statusalchemy evm status <call-id-or-tx-hash>

Native token address for swaps: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE.

Most wallet-signed EVM commands accept --signer session|local to override the active signer for that invocation. When both signers are configured and no active one is chosen, the CLI defaults to session and prints a warning.

Solana

Solana transaction commands use a local Solana wallet (alchemy wallet connect --mode local --chain solana). Use --fee-sponsored and --fee-policy-id <id> on supported actions to request fee sponsorship; persist defaults with alchemy config set solana-fee-sponsored true / alchemy config set solana-fee-policy-id <id>.

TaskCommand
Solana JSON-RPCalchemy solana rpc <method> [params...]
Solana DAS (NFTs/assets)alchemy solana das <method> '<json>'
Send native SOLalchemy solana send <to> <amount> [-n solana-mainnet]
Approve SPL token delegatealchemy solana delegate approve --token-account <addr> --mint <addr> --delegate <addr> --amount <n> --decimals <n>
Revoke SPL token delegatealchemy solana delegate revoke --token-account <addr>
Check Solana tx statusalchemy solana status <signature>
List program accountsalchemy solana program accounts <program-id> [--filters '<json>'] [--encoding <enc>] [--limit <n>]
Show Solana accountalchemy solana program account <address>
Show Solana program metadataalchemy solana program show <program-id>
List Solana network IDsalchemy solana network list

alchemy solana swap is reserved for future support and is not implemented.

Cross-chain

Bridge supports EVM mainnets. For same-chain token exchanges, use alchemy evm swap.

TaskCommand
Quote a bridgealchemy xchain bridge quote --from <token> --to <token> --amount <n> --to-network <network>
Execute a bridgealchemy xchain bridge execute --from <token> --to <token> --amount <n> --to-network <network>

Source network comes from -n, --network.

Wallets and signing

A wallet session is a CLI-bound signer that the user approves in the Agent Wallets dashboard. The agent never sees the private key. Sessions expire automatically and can be revoked from the CLI or the dashboard. Session signing capabilities the server may grant: evm.signMessage, evm.signTypedData, evm.signAuthorization, evm.prepareCalls, evm.sendCalls, solana.signTransaction. The session signer does not support raw EVM transaction signing — use the action commands (evm send, evm contract call, evm approve, evm swap, xchain bridge, solana send), which execute through Alchemy smart-wallet calls.

Run alchemy --json --no-interactive wallet status --verify before any state-changing wallet action — it returns the active signer, expiry, chain-specific session metadata, backend status, and enabled signer capabilities.

TaskCommand
Connect a wallet (session)alchemy wallet connect --mode session --instance-name <label>
Connect local EVM wallet (import private key file)alchemy wallet connect --mode local --chain evm --import <path>
Connect local Solana walletalchemy wallet connect --mode local --chain solana
Show wallet statusalchemy wallet status [--verify]
Show configured wallet addressesalchemy wallet address
Render an address as a QR codealchemy wallet qr
Pick active signer for EVM txnsalchemy wallet use <session|local>
Disconnect / revoke walletalchemy wallet disconnect
Per-command signer overrideappend --signer session|local

Webhook (Notify)

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

App management (Admin API)

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

The CLI's app and usage commands are thin wrappers over Alchemy's public Admin API (api.g.alchemy.com/admin-api/v1/...). Apps and Chains endpoints are public and self-serve; Usage endpoints are also self-serve for app-scoped queries. See references/operational-admin-api.md for the REST surface, auth model (x-alchemy-token bearer or the CLI's browser session), and endpoint enumeration.

Usage and metering

TaskCommand
Summary of usage over a rangealchemy usage summary --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--app-ids <ids>] [--networks <slugs>] [--metrics amount,usd]
Timeseries of usage over a rangealchemy usage timeseries --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD> [--granularity minute|hour|day|month] [--products <ids>] [--metrics amount] [--app-ids <ids>] [--networks <slugs>] [--methods <names>] [--request-types <types>] [--group-by <field>]
Timeseries (alias)alchemy usage time-series ...

Range limits on timeseries queries (as of 2026-07-02):

  • Free plan: 7 days maximum lookback.
  • Pay-as-you-go: 30 days maximum lookback.
  • Longer ranges: contact sales.

If the requested range exceeds the plan limit, the CLI does NOT error — it returns the allowed range and surfaces both the requested and returned range in the response so you can detect the truncation.

--metrics semantics differ by endpoint:

  • alchemy usage timeseries accepts only amount. The usd metric is not valid on time-series responses (removed 2026-08-13 per API-side change); pass --metrics amount or omit the flag.
  • alchemy usage summary accepts both amount and usd (comma-separated) on summary responses.

Auth: same browser session as alchemy app (Admin API access).

x402 payments (third-party APIs)

alchemy x402 request and alchemy x402 balance pay third-party APIs in USDC per RFC 402. This is a separate axis from --x402 / alchemy config set x402 true (which handles Alchemy-API auth for Alchemy's own gateway). Requires @alchemy/cli 0.22.0 or later.

TaskCommand
Make an x402-paid requestalchemy x402 request <url> [--dry-run] [--estimate] [--max-payment <usdc>] [--yes]
Show current x402 wallet balancealchemy x402 balance
  • Pass --max-payment <usdc> in non-interactive mode; without it the CLI exits 9 (non-interactive without cap).
  • Combining --yes with no --max-payment exits 2 (yes without cap).
  • Uses Circle Gateway batched nanopayments or direct EIP-3009 settlement depending on the third-party server.
  • Live example endpoint: https://nano.blockrun.ai (returns HTTP 402 on the first hit, then completes after the client-signed payment).

CLI admin and utilities

TaskCommand
Check for CLI updatesalchemy update-check
View configalchemy config list
Reset configalchemy config reset --yes
CLI versionalchemy version
Install MCP / Skills for a clientalchemy install mcp / alchemy install skills
Shell completionsalchemy completions <bash|zsh|fish>

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)
--x402Use x402 wallet-based gateway auth for this command
--wallet-key-file <path>Path to an EVM wallet private key file (for x402)
--solana-wallet-key-file <path>Path to a Solana wallet key file
--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>
APP_REQUIRED3NoSelect a default app: alchemy app 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 doctor 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 the error message; admin commands require an authenticated browser session
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 agentagentic-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.

bash
# 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 app 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 app select <id>`.
if [ -z "$KEY" ] || [ "$KEY" = "null" ]; then
  alchemy auth login              # opens browser; sets up account credentials
  alchemy --json app 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

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Alchemy Cli làm được gì?

Dùng Alchemy CLI (`@alchemy/cli`) để truy xuất dữ liệu blockchain trực tiếp, tra cứu giao dịch, truy vấn NFT/token/danh mục đầu tư, mô phỏng, truy vết/gỡ lỗi, đọc/ghi hợp đồng, gửi giao dịch có chữ ký ví, hoán đổi và bắc cầu xuyên chuỗi, Solana RPC/DAS cùng thao tác gửi từ ví, quản lý webhook và quản trị ứng dụng Alchemy. Đây là lộ trình ưu tiên khi tác nhân cần hoạt động trực tiếp (truy vấn, quản trị, tự động hóa cục bộ) nếu CLI đã được cài đặt cục bộ — hoặc khi có cả CLI lẫn MCP. Nếu chưa cài cả hai, hãy cài CLI bằng `npm i -g @alchemy/cli`. Dùng cho tác vụ trực tiếp của tác nhân trong ph...

Vì sao nên dùng Alchemy Cli trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Alchemy Cli là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Alchemy Cli trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/alchemyplatform/skills/tree/main/plugins/alchemy/skills/alchemy-cli. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Alchemy Cli?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Alchemy Cli với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Alchemy Cli với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Alchemy Cli có miễn phí không?

Có. Kỹ năng này được alchemyplatform phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇