ComputeNexa
Contents

Command-line tool (cnx)

cnx launches, lists, connects to and stops your GPUs from a terminal, a script or CI. It comes with the Python SDK and uses the same API key.

Install and sign in

pip install computenexa # or: pipx install computenexa export CNX_API_KEY="cnxk_..." cnx whoami

Create the key in the dashboard under API keys (see Use the API): "Look only" for listing, "Launch and stop" to launch.

A first session

cnx gpus --app datascience # pick a GPU cnx launch rtx-4090 --app datascience --hours 2 # shows the cost, asks, then waits cnx ssh cnx-7f3a9c # work on it cnx stop cnx-7f3a9c # unused time refunded

Commands

CommandWhat it doesExample
cnx whoamiWho the key acts as, your team, its balance and GPU limitcnx whoami
cnx gpusGPUs for sale now, cheapest first (--app, --region us|ca, --all)cnx gpus --app chat
cnx appsThe apps a GPU can start with, and whether they take a model or need an SSH keycnx apps
cnx launchLaunch a GPU; shows the cost and asks first (--yes to skip), waits until it's runningcnx launch l40s --app datascience --hours 4
cnx lsYour running machines (--all includes ended ones; --everyone the whole team's)cnx ls
cnx showOne machine: state, SSH command, API address, times and costcnx show cnx-7f3a9c
cnx sshConnect to a running machine; anything after the id is run on the machinecnx ssh cnx-7f3a9c nvidia-smi
cnx extendAdd time at the same pricecnx extend cnx-7f3a9c --hours 1
cnx stopStop one or more machines; unused time is refundedcnx stop cnx-7f3a9c
cnx projectsList projects; create or rm onecnx projects create titanic
cnx keysList SSH keys; add one (the public .pub file)cnx keys add "Work laptop" ~/.ssh/id_ed25519.pub
cnx usageGPU use and spending (--days)cnx usage --days 7
cnx receiptsFinished sessions and their cost (--days)cnx receipts
cnx schedulesList schedules; pause (--until), resume or rm onecnx schedules pause Weekdays --until 2026-12-01T08:00:00-08:00

cnx --help and cnx <command> --help list every option.

cnx launch options

OptionMeaning
gpuA GPU from cnx gpus, e.g. rtx-4090 (required)
--appbasic, datascience, chat, imagegen, modelapi or voice (required)
--hours / --minutesHow long to book (one of them, required); up to 7 days
--project NAMERestore a project into ~/work and save it back; --create-project makes it if missing
--labelA name for the machine
--modelFor chat, imagegen, modelapi and voice; default: the recommended model for the GPU
--countGPUs in the machine (default 1)
--regionany (default), us or ca
--no-wait / --timeoutReturn straight away, or how long to wait for it to be running (default 900 s)
--yesDon't ask before spending (scripts and CI)

Scripts and CI

  • --yes: launches and stops don't ask. Without it, a script that isn't running in a terminal is refused rather than spending money silently.
  • --json on any command prints machine-readable output (the API's own fields).
  • Exit codes: 0 done, 1 refused (the reason and its request id on stderr), 2 wrong usage.
  • SSH from CI: add the CI's public SSH key once (cnx keys add), and accept a new machine's host key on first connect, as below.
# .github/workflows/train.yml (excerpt): train on a private GPU, then stop it - run: pip install computenexa - env: CNX_API_KEY: ${{ secrets.CNX_API_KEY }} # a "launch and stop" key, stored as a secret run: | ID=$(cnx launch rtx-4090 --app datascience --hours 2 --project training --yes --json | jq -r .id) ssh -o StrictHostKeyChecking=accept-new "$ID@ssh.computenexa.com" "cd work && python train.py" cnx stop "$ID" --yes

More

The same, from Python: Python SDK and its reference. Every HTTP operation: API reference.