Skip to main content
The ChainStream CLI is the command-line front door to the same data products you’d hit via SDK, REST, GraphQL or WebSocket. It’s designed to compose with jq, shell pipelines and AI agents that drive shells.

Install

# Option A — global install (recommended for interactive use)
npm install -g @chainstream-io/cli

# Option B — zero-install, always-latest (recommended for agents and CI)
npx @chainstream-io/cli <command>
In the examples below, chainstream <cmd> is equivalent to npx @chainstream-io/cli <cmd>. Pick whichever invocation style matches your environment.

Authenticate

The CLI has two authentication paths. Both grant access to the REST API, GraphQL and DeFi commands from the same config file.
# Create an on-host wallet and auto-grant the nano trial (50K CU, 30 days)
chainstream login

# …or set an existing API Key explicitly
chainstream config set --key apiKey --value <your-api-key>

# Scripts can pass it via env var instead
export CHAINSTREAM_API_KEY=...
Config lives in ~/.config/chainstream/config.json; wallet keys live under ~/.config/chainstream/keys/. chainstream logout clears the wallet config but keeps the key files on disk.

Command groups

GroupPurpose
tokensearch, info, security, holders, candles, pools
markettrending, new, trades
walletprofile, pnl, holdings, activity, address, balance, pricing, sign, set-raw, link
dexroute, swap, create — build unsigned transactions for a host-managed wallet to sign
txsend, gas-price, estimate-gas
graphqlschema, query — see below
planstatus, purchase — uses x402 auto-pay, returns API Key
configset, get, auth
jobstatus
top-levellogin, logout, verify, bind-email, bind-email-verify
Global flag: --json prints single-line machine-readable JSON (default output is pretty-printed JSON).

First commands

chainstream token search --chain sol --keyword PUMP --limit 5
chainstream token security --chain sol --address <addr>
chainstream market trending --chain sol --duration 1h --limit 20
chainstream wallet pnl --chain sol --address <wallet>
chainstream dex route --chain sol --from SOL --to USDC --amount 1

GraphQL subcommand

The graphql group exposes ChainStream’s on-chain data warehouse (27 cubes across Solana, EVM, Trading) — useful when REST/MCP endpoints aren’t flexible enough (cross-cube JOINs, custom aggregations, time-series, multi-condition filters). Default endpoint: https://graphql.chainstream.io/graphql.

Discover the schema

chainstream graphql schema --summary              # compact catalog of all 27 cubes
chainstream graphql schema --type DEXTrades       # drill into one cube's fields
chainstream graphql schema --full                 # complete reference (best for agents)
chainstream graphql schema --summary --refresh    # bypass cache, re-fetch

Execute a query

# Inline query
chainstream graphql query \
  --query 'query { Solana { DEXTrades(limit:{count:5}) { Block { Time } } } }' \
  --json

# Query from file with variables
chainstream graphql query --file ./query.graphql --var '{"chain":"sol"}'
Auth is automatic: if an API Key is set (config set --key apiKey or CHAINSTREAM_API_KEY), the CLI sends it via X-API-KEY; otherwise it signs a SIWX token from the on-host wallet. GraphQL shares the same API Key and subscription pool as the REST API — no separate purchase.
On 402, graphql query returns a descriptive error. Run chainstream plan status, then chainstream plan purchase (which handles x402 auto-pay and saves the resulting API Key) and retry.

When to use

  • Quick exploration (“what’s happening right now?”)
  • Scripts, cron jobs, GitHub Actions
  • Giving an AI agent shell-executable ChainStream primitives
  • Custom GraphQL analytics without writing any client code
  • Preparing unsigned DeFi transactions for a user-controlled wallet to sign

Next

CLI reference

Every command, flag and exit code.

GraphQL access method

Endpoint, schema, query patterns.

chainstream-graphql skill

How AI agents should use graphql schema / query.

Agent Skills

How AI agents should use the CLI.