Configuration
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
| Variable | Meaning | Default |
|---|---|---|
CMDOP_TOKEN | Relay Bearer token (machines / fleets / tunnels / schedules / keys) | — (required for relay ops) |
CMDOP_BASE_URL | Relay REST root (e.g. https://your-server.cmdop.host, shown in your cmdop.com account) | — (required; no default) |
CMDOP_API_KEY | Platform API key (for skills) | — (required for skills) |
CMDOP_API_BASE_URL | Platform REST root | https://api.cmdop.com |
CMDOP_FLEET_ID | Default fleet for fleet-scoped ops | none |
CMDOP_TIMEOUT_MS | Per-call timeout, milliseconds | 30000 |
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 plane —
machines,fleets,tunnels,schedules,keys. Authenticated withCMDOP_TOKENagainstCMDOP_BASE_URL. - Platform plane —
skills. Authenticated withCMDOP_API_KEYagainstCMDOP_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:
- Explicit argument to the constructor.
- Environment variable (
CMDOP_*). - 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.