> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Use the OrbitFlare CLI in shell scripts, CI/CD pipelines, and agent-driven automation. Every command supports --json for machine-readable output.

The [OrbitFlare CLI](/cli) is a single binary that wraps RPC queries, gRPC and Jetstream streaming with YAML configs, project scaffolding, and account management. For agent and automation workflows, the key feature is `--json`: every command emits structured output that composes cleanly with `jq`, shell pipes, GitHub Actions, and cron jobs.

<Tip>
  For interactive AI workflows in Claude Code, Cursor, or other MCP hosts, prefer the [MCP server](/agents/mcp). The CLI is best for shell-driven automation where you want deterministic exit codes and parseable output.
</Tip>

## Install

```bash theme={null}
cargo install orbitflare           # requires Rust 1.85+
orbitflare --version
```

See the [full CLI reference](/cli) for installation alternatives, auth methods, and the complete command surface.

## Headless setup

For non-interactive environments (CI, containers, scripts), authenticate with an API key directly, no browser flow needed:

```bash theme={null}
orbitflare auth login --x-orbit-key "$ORBITFLARE_API_KEY"
orbitflare config set rpc.url "$ORBITFLARE_RPC_URL"
orbitflare config set grpc.url "$ORBITFLARE_GRPC_URL"
orbitflare config set jetstream.url "$ORBITFLARE_JETSTREAM_URL"
orbitflare ping --json
```

Credentials are stored in the OS keychain by default. In containers without a keychain, set `ORBITFLARE_CONFIG_DIR` to a writable path and the CLI will fall back to a file-based config.

## JSON output

Every command supports `--json`:

```bash theme={null}
$ orbitflare rpc slot --json
{"slot": 312456789}

$ orbitflare rpc balance Gh9ZwEm... --json
{"address": "Gh9ZwEm...", "lamports": 12500000000, "sol": 12.5}
```

Compose with `jq` for one-liners:

```bash theme={null}
# Print just the slot
orbitflare rpc slot --json | jq -r '.slot'

# Alert if balance drops below 1 SOL
SOL=$(orbitflare rpc balance "$WALLET" --json | jq -r '.sol')
if (( $(echo "$SOL < 1" | bc -l) )); then
  echo "Balance low: $SOL SOL"
  exit 1
fi
```

## Streaming with YAML configs

The CLI streams Jetstream and Yellowstone gRPC using a declarative YAML config, no code required:

```yaml theme={null}
# pump-trades.yaml
transactions:
  pump_trades:
    account_include:
      - "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"

reconnect:
  initial_delay_ms: 100
  max_delay_ms: 30000
  multiplier: 2.0
  max_retries: 0
```

Run it (Jetstream or Yellowstone gRPC):

```bash theme={null}
orbitflare jet --config pump-trades.yaml | your-indexer
orbitflare grpc --config pump-trades.yaml | your-indexer
```

<Tip>
  Have an MCP-equipped agent generate the YAML for you. The [MCP server](/agents/mcp) `subscribeTransactions` tool emits a CLI-ready config from a natural-language description.
</Tip>

## Scripting patterns

### Tail recent signatures and process them

```bash theme={null}
orbitflare rpc history "$WALLET" --limit 50 --json \
  | jq -r '.[].signature' \
  | while read sig; do
      orbitflare rpc tx "$sig" --json > "txs/$sig.json"
    done
```

### CI health check

```yaml theme={null}
# .github/workflows/rpc-health.yml
name: OrbitFlare RPC health
on:
  schedule:
    - cron: '*/15 * * * *'
jobs:
  ping:
    runs-on: ubuntu-latest
    steps:
      - uses: actions-rs/toolchain@v1
        with: { toolchain: stable }
      - run: cargo install orbitflare
      - run: orbitflare auth login --x-orbit-key ${{ secrets.ORBITFLARE_API_KEY }}
      - run: orbitflare config set rpc.url ${{ secrets.ORBITFLARE_RPC_URL }}
      - run: orbitflare ping --json
```

### Scaffold a project from an agent

The CLI ships templates for common Solana projects. An agent can list them and spin one up in one shot:

```bash theme={null}
orbitflare template --list --json
orbitflare template --install solana-copy-trader --dir ./bot
```

## Profiles

Switch between accounts or environments without re-authenticating each time:

```bash theme={null}
orbitflare auth login --profile prod --x-orbit-key "$PROD_KEY"
orbitflare auth login --profile dev  --x-orbit-key "$DEV_KEY"

orbitflare auth switch --profile prod
orbitflare auth status --json
```

## Source

* CLI repo: [github.com/orbitflare/orbit-cli](https://github.com/orbitflare/orbit-cli)
* Full reference: [CLI documentation](/cli)
