ComputeNexa

Use the ComputeNexa API

The ComputeNexa API lets your scripts, CI jobs or platform do what you do in the dashboard: see prices, launch private GPUs, check on them and stop them. It's the same API the dashboard uses, at https://api.computenexa.com/v1, with an API key instead of a sign-in.

Using Python? Use the SDK

pip install computenexa gives you the same API as Python methods, with waiting, retries and clear errors built in. See Python SDK. This page is for every other language, and for curl; both need an API key (step 1).

pip install computenexa

computenexa on PyPI

1. Create an API key

Owners and admins of a team create keys; members ask one of them.

  1. In the dashboard, open API keys in the sidebar.
  2. Name the key after what will use it, e.g. "Training pipeline".
  3. Choose what it can do: Look only (prices, machines, balance) or Launch and stop machines too.
  4. Click Create key.
The API keys page: name, what it can do, Create key, and a quick start

The key starts with cnxk_ and is shown only once: copy it straight away. We keep only a fingerprint of it, so we can't show it again; if it's lost, revoke it and create a new one.

A new key is shown once, with copy-ready examples
This example key isn't real.

2. Keep it safe

3. Make your first call

Send the key in the Authorization header of every request:

export CNX_API_KEY="cnxk_..." curl -H "Authorization: Bearer $CNX_API_KEY" https://api.computenexa.com/v1/me

The reply says who the key acts as, your team, its balance and its GPU limit:

{"email": "alex@acme.com", "balance_cents": 9677, "max_concurrent_gpus": 4, "organization": {"name": "Acme Corp", "role": "owner", "members": 4}, ...}

Amounts are in US cents: 9677 is $96.77. Times are ISO 8601, in UTC.

4. Find a GPU and its price

curl -H "Authorization: Bearer $CNX_API_KEY" https://api.computenexa.com/v1/catalog

Each entry in gpus has a slug (what you launch with), display_name, vram_gb, price_per_hour_cents, available, billing_unit (minute, or hour for GPUs billed per started hour), regions and families (the apps it runs). ?region=us or ?region=ca lists only GPUs in that country, at that region's price.

5. Launch, wait, stop

# Launch: charged now for the booked time curl -X POST https://api.computenexa.com/v1/instances \ -H "Authorization: Bearer $CNX_API_KEY" -H "Content-Type: application/json" \ -d '{"gpu": "rtx-4090", "image_family": "datascience", "duration_minutes": 120}' # Check on it every 10-30 seconds until "state" is "running" curl -H "Authorization: Bearer $CNX_API_KEY" https://api.computenexa.com/v1/instances/cnx-7f3a9c # Add an hour curl -X POST https://api.computenexa.com/v1/instances/cnx-7f3a9c/extend \ -H "Authorization: Bearer $CNX_API_KEY" -H "Content-Type: application/json" -d '{"minutes": 60}' # Stop: unused minutes are refunded curl -X POST -H "Authorization: Bearer $CNX_API_KEY" https://api.computenexa.com/v1/instances/cnx-7f3a9c/stop

A machine is named by its id, like cnx-7f3a9c. Its state goes requested → provisioning → running → stopping → terminated (or failed if it couldn't start, with a full refund). While it runs, the reply includes ssh_command, time_left_seconds, expires_at and cost_so_far_cents; at the end, end_reason and refunded_cents.

Choose the app: image_family

image_family is the same choice as What do you want to do? on the launch page:

On the launch pageIn the API (image_family)Pick it to…AI modelSSH key
Private ChatchatChat with open AI models about your documents, in your browserOptional (recommended one by default)Not needed
Image Generation (ComfyUI)imagegenCreate images with SDXL or FLUX in ComfyUI, in your browserOptional (recommended one by default)Not needed
Model API (vLLM)modelapiAn AI model behind your own API key, for your apps and scriptsRequiredNot needed
Voice AgentvoiceSpeech in, spoken AI reply out: assistants and phone agentsRequired (one offered)Not needed
Notebook (Jupyter)datascienceJupyterLab with PyTorch, pandas and Hugging Face: analysis, training, fine-tuningNoneRecommended
Basic (SSH only)basicUbuntu with CUDA and Python for your own code, over SSH or VS CodeNoneRequired

A GPU runs only the apps in its families in GET /v1/catalog. For apps that take a model, launch_models[<family>] in the catalog lists the models (with the GPU memory each needs) and the recommended one per GPU size; leave model out to get the recommended one. What's installed in each app's images, package by package: GET /v1/images/<family> (no key needed), also shown at What's in each image.

Launch fields

FieldNeededWhat it is
gpuRequiredA GPU's slug from /v1/catalog, e.g. rtx-4090, l40s, a100-80gb
image_familyOne of these twoThe app: basic, datascience, chat, imagegen, modelapi or voice (see families in /v1/catalog)
imageOne of these twoAn exact image slug from the GPU's images list, instead of image_family
duration_minutesRequiredHow long to book, in minutes (up to 7 days). Some GPUs bill per started hour: whole hours
gpu_countOptionalGPUs in one machine (default 1)
regionOptionalany (default), us or ca: keep the machine in that country
labelOptionalA name to tell your machines apart
modelOptionalThe model to prepare first for chat, image and model API apps (default: the recommended one)
project_idOptionalRestore a project's files on the machine and save them back

SSH uses the SSH keys on your account (see Getting started); apps that open in the browser don't need one. Browser apps are opened from the dashboard.

6. Example in Python

With the Python SDK, the launch, wait and stop above become:

# pip install computenexa from computenexa import Client cnx = Client() # reads CNX_API_KEY # Launch an RTX 4090 with Jupyter for 2 hours; stopped when the block ends, # even if your code fails, and unused minutes are refunded. with cnx.gpu("rtx-4090", app="datascience", hours=2, label="nightly training") as machine: print(machine.id, machine.ssh_command) # ... run your job over SSH ...

7. What you can call

The API reference lists every operation by name (for example listProjects, createProject, launchInstance) with all its fields.

TaskRequestKey needed
GPUs, prices, stock, appsGET /v1/catalogLook only
Your account, team, balance and GPU limitGET /v1/meLook only
Your machines (add ?status=active or ended)GET /v1/instancesLook only
The team's machines (owners and admins)GET /v1/instances?whose=everyoneLook only
One machine's statusGET /v1/instances/{id}Look only
Launch a GPUPOST /v1/instancesLaunch and stop
Add timePOST /v1/instances/{id}/extendLaunch and stop
Stop (unused time refunded)POST /v1/instances/{id}/stopLaunch and stop
Cancel before it starts (full refund)POST /v1/instances/{id}/cancelLaunch and stop
BalanceGET /v1/balanceLook only
Charges and top-upsGET /v1/ledgerLook only
Projects (saved work)GET /v1/projectsLook only
SSH keysGET, POST /v1/ssh-keysLook only to list; launch and stop to add
Schedules/v1/me/schedulesLook only to list; launch and stop to change

Team, billing, API key and admin settings aren't reachable with a key, whatever it can do: they need a person signed in to the dashboard.

8. Limits and safety

9. Errors

Every refusal has the same shape, with a stable code to check and a message you can show:

{"error": "insufficient_credits", "message": "Not enough credits for this duration.", "request_id": "a0ab1c25..."}
HTTPerrorMeaning
401not_signed_inKey missing, mistyped or revoked, or its creator left the team
402insufficient_creditsNot enough credits for this duration
403forbiddenThe key can't do this: a look-only key, or a dashboard-only setting
404not_foundNo such machine, or not one you can see
409gpu_limit_reachedYour team (or you) already run as many GPUs as allowed
409no_capacityThat GPU is fully booked right now: retry or pick another
409not_runningOnly a running machine can be extended or stopped
422unknown_gpu, invalid, …A field is missing or wrong; the message says which
429rate_limitedMore than 120 requests a minute with this key

Writing to support? Include the request_id and we can trace exactly what happened.

More guides

Questions? Email support@computenexa.com.