ComputeNexa Python SDK
Launch, use and stop private GPUs on ComputeNexa from Python. Each GPU is reserved for your team, runs open AI models or your own code, and is paid by the minute from your team's prepaid credits.
pip install computenexa
Quick start
Create an API key in the dashboard under API keys ("Launch and stop" to launch), then:
export CNX_API_KEY="cnxk_..."
from computenexa import Client
cnx = Client() # reads CNX_API_KEY
# Launch an RTX 4090 with JupyterLab and PyTorch for 2 hours; it's stopped when the block ends,
# even if your code fails, and unused minutes are refunded.
with cnx.gpu("rtx-4090", app="datascience", hours=2) as machine:
print(machine.ssh_command) # ssh cnx-7f3a9c@ssh.computenexa.com
... # your work
Choose a GPU and an app
catalog = cnx.catalog() # live prices and stock; catalog.apps describes each app
for gpu in catalog.available(app="chat"): # for sale now, cheapest first
print(gpu.slug, gpu.vram_gb, "GB", gpu.price_per_hour_cents / 100, "$/h")
chat = catalog.apps["chat"]
print(chat.recommended_model(vram_gb=48)) # our model pick for a 48 GB GPU
print(cnx.image_contents("datascience")) # every package and version installed
app= |
On the launch page | For |
|---|---|---|
chat |
Private Chat | chat with open AI models about your documents, in your browser |
imagegen |
Image Generation (ComfyUI) | images with SDXL or FLUX |
modelapi |
Model API (vLLM) | an AI model behind your own API key |
voice |
Voice Agent | speech in, spoken AI reply out |
datascience |
Notebook (Jupyter) | JupyterLab, PyTorch, pandas: analysis, training, fine-tuning |
basic |
Basic (SSH only) | Ubuntu + CUDA for your own code |
Keep files between sessions with projects
A project is saved storage: launched with it, a GPU starts with the project's files in ~/work and saves
~/work back automatically.
project = cnx.get_or_create_project("titanic-training")
machine = cnx.launch("l40s", app="datascience", hours=4, project=project, label="nightly training")
machine.wait_until_running(on_progress=lambda m: print(m.state, m.startup_progress or ""))
print(machine.ssh_command)
# ... later
machine.stop()
print("refunded", machine.refunded_cents / 100)
Machines
cnx.list_instances(active=True) # your running and starting machines
cnx.list_instances(everyone=True) # the whole team's (owners and admins)
machine = cnx.get_instance("cnx-7f3a9c")
machine.extend(hours=1) # same price it launched with
machine.stop() # stops if running, cancels if still starting
Account, credits and SSH keys
me = cnx.account()
print(me.email, me.organization.name, me.organization.role, me.balance, me.max_concurrent_gpus)
for entry in cnx.ledger(limit=20):
print(entry.created_at, entry.description, entry.amount_cents / 100)
cnx.add_ssh_key("Work laptop", open("/Users/me/.ssh/id_ed25519.pub").read()) # the PUBLIC key only
Errors
Every refusal raises a subclass of computenexa.ComputeNexaError with a stable code, a message you can show
and a request_id to quote to support:
| Exception | When |
|---|---|
InsufficientCreditsError |
not enough credits for the launch or extension |
NoCapacityError |
that GPU is fully booked right now: retry or pick another |
GpuLimitReachedError |
your team (or you) already run as many GPUs as allowed |
ProjectInUseError |
another GPU is using the project |
AuthenticationError |
the key is missing, mistyped or revoked |
PermissionDeniedError |
a look-only key tried to launch, or a dashboard-only setting |
NotFoundError |
no such machine or project, or not one you can see |
LaunchFailedError |
the machine couldn't start (refunded in full) |
WaitTimeoutError |
wait_until_running gave up; the machine may still start |
from computenexa import NoCapacityError
for gpu in ["rtx-4090", "l40s", "a40"]:
try:
machine = cnx.launch(gpu, app="chat", hours=1)
break
except NoCapacityError:
continue
Reads are retried automatically when the API is busy (429) or has a server error. A launch is never retried after an uncertain failure, so it can't start two GPUs.
Configuration
Client(api_key=...) or CNX_API_KEY |
your API key |
Client(base_url=...) or CNX_API_URL |
defaults to https://api.computenexa.com/v1 |
Client(timeout=30, max_retries=3) |
per request |
Help
- Guide: https://app.computenexa.com/help/api
- Every operation: https://app.computenexa.com/help/api/reference
- Support: support@computenexa.com
MIT licensed. © ComputeNexa.
Metadata
Release files for computenexa 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| computenexa-0.1.1.tar.gz | 29.9 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| computenexa-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.0 kB
Release files / computenexa-0.1.1.tar.gz
| Download URL | computenexa-0.1.1.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a59c29e2a380652a09ba20e0b0b2b2062af0356b6471be0d1b7ce483ccdf953c
|
|
BLAKE2b-256 checksum How to use checksums |
c384ad524f13c1bceb27a4d4056a45948add28819dc11bce272c808ae3e8858a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / computenexa-0.1.1-py3-none-any.whl
| Download URL | computenexa-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
531c0536fe1816073976bf5da4c2023555773ffb43f823d479a6c6c1d1bb6330
|
|
BLAKE2b-256 checksum How to use checksums |
6a2167d13571d95dcf951855d603ec7792fa83b69f049df099c8610f4ce8c96f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for computenexa 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for computenexa-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.