Skip to Content
SDKConfiguration

Configuration

TL;DR

The client reads configuration from constructor arguments and CMDOP_* environment variables. Two planes mean two credentials: a relay token (CMDOP_TOKEN) for machines / fleets / tunnels / schedules / keys, and a platform API key (CMDOP_API_KEY) for skills. Precedence is always explicit argument → environment variable → default.

Environment variables

VariableMeaningDefault
CMDOP_TOKENRelay Bearer token (machines / fleets / tunnels / schedules / keys)— (required for relay ops)
CMDOP_BASE_URLRelay REST root (e.g. https://your-server.cmdop.host, shown in your cmdop.com account)— (required; no default)
CMDOP_API_KEYPlatform API key (for skills)— (required for skills)
CMDOP_API_BASE_URLPlatform REST roothttps://api.cmdop.com
CMDOP_FLEET_IDDefault fleet for fleet-scoped opsnone
CMDOP_TIMEOUT_MSPer-call timeout, milliseconds30000

from_env() / fromEnv() builds a client straight from these.

The two planes

One Client, two destinations — the client routes each call to the right plane by the namespace you use:

  • Relay planemachines, fleets, tunnels, schedules, keys. Authenticated with CMDOP_TOKEN against CMDOP_BASE_URL.
  • Platform planeskills. Authenticated with CMDOP_API_KEY against CMDOP_API_BASE_URL.

Set whichever credentials your code needs. If you only call machines.*, a relay token is enough; if you only call skills.*, an API key is enough; set both to use both.

Client options

Every environment variable has a matching constructor argument, which takes precedence:

from cmdop import Client c = Client( token="...", # CMDOP_TOKEN base_url="...", # CMDOP_BASE_URL api_key="...", # CMDOP_API_KEY api_base_url="...", # CMDOP_API_BASE_URL fleet_id="...", # CMDOP_FLEET_ID timeout_ms=30000, # CMDOP_TIMEOUT_MS )
import { Client } from "@cmdop/sdk"; const c = new Client({ token: "...", // CMDOP_TOKEN baseUrl: "...", // CMDOP_BASE_URL apiKey: "...", // CMDOP_API_KEY apiBaseUrl: "...", // CMDOP_API_BASE_URL fleetId: "...", // CMDOP_FLEET_ID timeoutMs: 30000, // CMDOP_TIMEOUT_MS });

In Node, passing a string is shorthand for { token }: new Client("...").

Precedence

For every setting, the resolution order is:

  1. Explicit argument to the constructor.
  2. Environment variable (CMDOP_*).
  3. Default (from the table above).

Default fleet

Fleet-scoped calls (fleets.members.*, fleets.machines.*, schedules.*, keys.*) take an optional fleet_id. When you omit it, the client falls back to CMDOP_FLEET_ID. Set it once in the environment to avoid repeating the id on every call.

Timeouts

CMDOP_TIMEOUT_MS (default 30000) bounds each call. A timed-out or dropped call surfaces as a typed error — see Errors.