jq, shell pipelines and AI agents that drive shells.
Install
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.~/.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
Global flag:
--json prints single-line machine-readable JSON (default output is pretty-printed JSON).
First commands
GraphQL subcommand
Thegraphql 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
Execute a query
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.

