Skip to main content

CLI

The Context CLI wraps the SDK into 35+ commands with dual-mode output — human-readable tables in terminals, JSON when piped. Built for both human traders and AI agents.

35+ commands

Markets, orders, portfolio, and account management

JSON output

Structured output for parsing, piping, and automation

Dual mode

Tables in TTY, JSON when piped to other tools

Gasless onboarding

Setup and deposit without ETH for gas

Install

npm install -g @contextwtf/cli
Requires Node.js 18+.

Quick start

Existing user

export CONTEXT_API_KEY="your-api-key"
export CONTEXT_PRIVATE_KEY="0x..."
context-cli markets list --status active

New user

context-cli setup
context-cli account mint-test-usdc --amount 1000
context-cli account deposit 1000
context-cli markets list --status active --limit 5

JSON output

Use the --json flag or pipe to automatically get JSON:
# Explicit JSON flag
context-cli markets list --status active --json

# Auto-detected when piped
context-cli markets list --status active | jq '.[0].title'

Global options

FlagEnv varDescription
--api-key <key>CONTEXT_API_KEYAPI key for authentication
--private-key <key>CONTEXT_PRIVATE_KEYPrivate key for signing orders
--rpc-url <url>CONTEXT_RPC_URLBase Sepolia RPC endpoint
--base-url <url>CONTEXT_BASE_URLOverride API base URL
--jsonForce JSON output
Resolution order: flag > environment variable > config file (~/.context/config.json).