Skip to content

CLI Reference

The Gambi CLI is the operational surface for hubs, rooms, participants, and room events.

The CLI is resource-oriented:

Terminal window
gambi hub serve
gambi room create
gambi room list
gambi room get
gambi participant join
gambi participant leave
gambi participant heartbeat
gambi events watch
gambi self update

gambi-tui remains the separate human-first monitoring interface.

Terminal window
curl -fsSL https://raw.githubusercontent.com/arthurbm/gambi/main/scripts/install.sh | bash

Verify the install:

Terminal window
gambi --version

Every operational command inherits the same set of global flags from the shared command base. They can also be driven by environment variables, which is useful for scripts and supervisors.

FlagDescription
--format <text|json|ndjson>select output format
--env <name>pick a named environment from the CLI config file
--interactiveallow prompts for missing required values
--no-interactivedisable all prompts
--verboseinclude extended details in output
--quietreduce non-essential text output
ModeMeaning
textcompact human-readable output
jsonone structured JSON object
ndjsonone JSON object per line

Defaults:

ContextDefault
TTY + one-shot commandtext
piped stdout + one-shot commandjson
piped stdout + streaming commandndjson

Streaming commands coerce --format json to ndjson so every event is a standalone JSON line.

VariableEffect
GAMBI_FORMATfallback for --format
GAMBI_ENVfallback for --env
GAMBI_NO_INTERACTIVE=1disable prompts everywhere
XDG_CONFIG_HOMEoverride the base directory for ~/.config/gambi/config.json
CodeMeaning
0success
1internal or unexpected failure
2invalid usage (missing flag, bad value, 400/422 from hub)
3connectivity or dependency failure (unreachable hub, 401/403/503)
4remote rejection or conflict (404/409 from hub)

Agent-style supervisors can key retries off these codes. 2 should not be retried, 3 usually should, and 4 means the operation is rejected by the hub state.

The CLI reads XDG config from:

~/.config/gambi/config.json

Example:

{
"defaultEnv": "local",
"envs": {
"local": {
"hubUrl": "http://localhost:3000",
"endpoint": "http://localhost:11434"
},
"lab": {
"hubUrl": "http://192.168.1.10:3000",
"endpoint": "http://localhost:11434",
"serve": {
"host": "0.0.0.0",
"port": 3000,
"mdns": true
}
}
}
}

Select an environment per-invocation with --env lab or globally with GAMBI_ENV=lab.

Start the Gambi hub.

Terminal window
gambi hub serve [options]

Options:

OptionDescription
--hosthost to bind to (default from env config or 0.0.0.0)
--portport to bind to (default from env config or 3000)
--mdnsenable mDNS discovery so other machines can find the hub
--dry-runprint the resolved startup plan and exit without binding

Examples:

Terminal window
gambi hub serve
gambi hub serve --port 3000 --mdns
gambi hub serve --dry-run --format ndjson

Structured lifecycle events (--format json|ndjson):

EventMeaning
startedhub bound to bindUrl
mdns_registeredmDNS advertisement is active under name
signal_receivedSIGINT or SIGTERM observed during shutdown
stoppedhub has released the port

Create a room through the management API.

Terminal window
gambi room create --name <name> [options]

Options:

OptionDescription
--name, -nroom display name
--password, -poptional room password
--config <path|->runtime config JSON file or - for stdin
--hub, -Hhub URL
--dry-runvalidate and print the request without creating the room

Examples:

Terminal window
gambi room create --name "Demo"
gambi room create --name "Demo" --config ./room.json
cat ./room.json | gambi room create --name "Demo" --config -
gambi room create --name "Demo" --dry-run --format json

List room summaries from the management API.

Terminal window
gambi room list [options]

Options:

OptionDescription
--hub, -Hhub URL
--sort <participant-count|created-at|name>sort key (default participant-count)
--reversereverse the selected sort order

Default sort is participant-count descending, with created-at descending as tiebreaker.

Examples:

Terminal window
gambi room list
gambi room list --format json
gambi room list --sort created-at --reverse
gambi room list --hub http://192.168.1.10:3000

Fetch one room summary by code.

Terminal window
gambi room get --code <room-code> [options]

Options:

OptionDescription
--code, -croom code
--hub, -Hhub URL

Examples:

Terminal window
gambi room get --code ABC123
gambi room get --code ABC123 --format json

Register a participant and keep its tunnel alive.

Terminal window
gambi participant join --room <room> --participant-id <id> --model <model> [options]

Options:

OptionDescription
--roomroom code
--participant-idstable participant identifier
--nicknamedisplay name
--modelmodel to expose
--endpointlocal endpoint used for probing and inference
--headerauth header in Header=Value format
--header-envauth header in Header=ENV_VAR format
--passwordroom password
--config <path|->runtime config JSON file or stdin
--no-specsskip machine specs collection
--hubhub URL
--dry-runvalidate and preview the session

Notes:

  • --participant-id is required for non-interactive retry-safe automation.
  • --config - reads participant runtime config JSON from stdin.
  • The CLI probes the endpoint before registration to validate the model and detect capabilities.
  • Participant joins now always use a tunnel, so the provider endpoint can stay on localhost even when the hub runs on another machine. See How tunnels work.

Examples:

Terminal window
gambi participant join \
--room ABC123 \
--participant-id worker-1 \
--model llama3
gambi participant join \
--room ABC123 \
--participant-id worker-1 \
--model llama3 \
--endpoint http://localhost:1234
gambi participant join \
--room ABC123 \
--participant-id worker-1 \
--model llama3 \
--hub http://192.168.1.10:3000
gambi participant join \
--room ABC123 \
--participant-id worker-1 \
--model llama3 \
--dry-run \
--format ndjson

NDJSON lifecycle events:

EventMeaning
preparedendpoint probing and payload assembly completed
registeredparticipant registration succeeded
tunnel_connectedthe participant tunnel is open
leavingshutdown started
leftparticipant removal completed
heartbeat_failedmanagement heartbeat loop failed
tunnel_failedtunnel connectivity failed

Remove a participant from a room.

Terminal window
gambi participant leave --room <room> --participant-id <id> [options]

Options:

OptionDescription
--room, -rroom code
--participant-idparticipant identifier
--hub, -Hhub URL

Example:

Terminal window
gambi participant leave --room ABC123 --participant-id worker-1

Send one participant heartbeat. Useful for automation and liveness probing independently from the long-running participant join command.

Terminal window
gambi participant heartbeat --room <room> --participant-id <id> [options]

Options:

OptionDescription
--room, -rroom code
--participant-idparticipant identifier
--hub, -Hhub URL

Example:

Terminal window
gambi participant heartbeat --room ABC123 --participant-id worker-1

Watch room events from the management SSE stream.

Terminal window
gambi events watch --room <room> [options]

Options:

OptionDescription
--room, -rroom code (required)
--hub, -Hhub URL

Examples:

Terminal window
gambi events watch --room ABC123
gambi events watch --room ABC123 --format ndjson

Important event types:

  • connected
  • room.created
  • participant.joined
  • participant.updated
  • participant.left
  • participant.offline
  • llm.request
  • llm.complete
  • llm.error

See Observability for the field shape of the llm.* events.

Update the installed CLI. The command detects the install source (bun, npm, or standalone binary) and runs the matching upgrade path.

Terminal window
gambi self update [options]

Options:

OptionDescription
--manager <bun|npm>force a package manager instead of auto-detection
--yesskip confirmation prompt
--dry-runprint the resolved update plan and exit

Examples:

Terminal window
gambi self update
gambi self update --yes
gambi self update --dry-run --format json