Skip to content

Package

@canister-software/consensus-cli is one npm package with two parts:

  • the SDK, ProxyClient, SocketClient, and createPaymentFetch(), which you import into your own JavaScript or TypeScript code;
  • the consensus command, a CLI and full-screen TUI for tunnels, proxying, WebSockets, and leased IPs.

As a project dependency, to use the SDK:

Terminal window
npm install @canister-software/consensus-cli

Globally, to use the consensus command anywhere:

Terminal window
npm install -g @canister-software/consensus-cli

The package is in beta; npm installs the current 0.2.0-beta release.

UseRequires
SDKNode.js 20.19 or newer, or Bun 1.3.0 or newer
consensus commandBun 1.3.0 or newer. The command runs on Bun even when installed with npm
import {
ProxyClient, // route outbound HTTP through the network
SocketClient, // open metered WebSocket sessions
createPaymentFetch, // a fetch that answers x402 payment challenges
resolveSigners, // load signers from CONSENSUS_* environment variables
} from '@canister-software/consensus-cli'

The package also exports connectToNode for the direct data path, batch and profile helpers, and their TypeScript types.

  • Setup: configure the CLI and payment credentials
  • Client Setup: create fetchWithPayment for the SDK
  • Usage: every ProxyClient and SocketClient option