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 whoamiCreate 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 refundedCommands
| Command | What it does | Example |
|---|---|---|
cnx whoami | Who the key acts as, your team, its balance and GPU limit | cnx whoami |
cnx gpus | GPUs for sale now, cheapest first (--app, --region us|ca, --all) | cnx gpus --app chat |
cnx apps | The apps a GPU can start with, and whether they take a model or need an SSH key | cnx apps |
cnx launch | Launch a GPU; shows the cost and asks first (--yes to skip), waits until it's running | cnx launch l40s --app datascience --hours 4 |
cnx ls | Your running machines (--all includes ended ones; --everyone the whole team's) | cnx ls |
cnx show | One machine: state, SSH command, API address, times and cost | cnx show cnx-7f3a9c |
cnx ssh | Connect to a running machine; anything after the id is run on the machine | cnx ssh cnx-7f3a9c nvidia-smi |
cnx extend | Add time at the same price | cnx extend cnx-7f3a9c --hours 1 |
cnx stop | Stop one or more machines; unused time is refunded | cnx stop cnx-7f3a9c |
cnx projects | List projects; create or rm one | cnx projects create titanic |
cnx keys | List SSH keys; add one (the public .pub file) | cnx keys add "Work laptop" ~/.ssh/id_ed25519.pub |
cnx usage | GPU use and spending (--days) | cnx usage --days 7 |
cnx receipts | Finished sessions and their cost (--days) | cnx receipts |
cnx schedules | List schedules; pause (--until), resume or rm one | cnx schedules pause Weekdays --until 2026-12-01T08:00:00-08:00 |
cnx --help and cnx <command> --help list every option.
cnx launch options
| Option | Meaning |
|---|---|
gpu | A GPU from cnx gpus, e.g. rtx-4090 (required) |
--app | basic, datascience, chat, imagegen, modelapi or voice (required) |
--hours / --minutes | How long to book (one of them, required); up to 7 days |
--project NAME | Restore a project into ~/work and save it back; --create-project makes it if missing |
--label | A name for the machine |
--model | For chat, imagegen, modelapi and voice; default: the recommended model for the GPU |
--count | GPUs in the machine (default 1) |
--region | any (default), us or ca |
--no-wait / --timeout | Return straight away, or how long to wait for it to be running (default 900 s) |
--yes | Don'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" --yesMore
The same, from Python: Python SDK and its reference. Every HTTP operation: API reference.