αlyxruntime

Use any other computer’s CPU/GPU as your Jupyter runtime — like Colab’s “connect to local runtime”, but for any machine you control, from the command line or from Python.

The host talks out to Cloudflare through cloudflared, so there is no port forwarding, no public IP, and HTTPS is included — it works from behind home routers, NAT and most firewalls.

Install

# on the machine that SHARES its GPU/CPU
pip install "alyxruntime[host]"

# on the machine that CONNECTS (lighter)
pip install alyxruntime

The source is here and the PYPI page is here.

Usage

On the host machine with the GPU

alyxruntime stream --allowed_ip 203.0.113.7                # your client's public IP
alyxruntime stream --allowed_ip 203.0.113.7 10.0.0.0/24    # several IPs / CIDR ranges
alyxruntime stream --allowed_ip all                        # any IP - the token is the only gate

It starts a Cloudflare quick tunnel (if cloudflared is missing it offers to download the official binary, or pass --install-cloudflared) and prints a ready-to-paste command with a random access token:

alyxruntime connect 'https://random-words.trycloudflare.com/?token=...'
Not sure what your public IP is? Run alyxruntime connect from the client anyway: the host replies access denied for IP x.x.x.x. Ask the host to add it with --allowed_ip x.x.x.x.

On the client

alyxruntime connect https://my-host:8765/?token=XXXX   # verifies, shows remote CPU/RAM/GPU, saves session
alyxruntime run train.py            # run a script   (also .ipynb, `-c "code"`, or stdin with `-`)
alyxruntime shell                   # interactive prompt; variables persist between commands
alyxruntime info                    # remote CPU / RAM / GPU
alyxruntime upload data.csv         # copy files to the host's working dir
alyxruntime download model.pt
alyxruntime restart                 # fresh kernel
alyxruntime disconnect --kill-kernel

Plots (plt.show()) are saved locally to ./alyx_outputs/.

VS Code / JupyterLab also work: Select Kernel → Existing Jupyter Server → paste the same URL.

From Python

from alyxruntime import Runtime

rt = Runtime.connect("https://my-host:8765/?token=XXXX")
rt.run("import torch; print(torch.cuda.is_available())")
res = rt.run("2 + 2", echo=False);  print(res.results)     # ['4']
rt.upload("data.csv"); rt.download("out.pt")

Host side from Python:

from alyxruntime import serve; serve(allowed_ip=["203.0.113.7"])

Stable URL (named tunnel)

Quick tunnels get a new random URL every run. For a fixed hostname, create a tunnel in the Cloudflare dashboard (Zero Trust → Networks → Tunnels), point a public hostname at http://localhost:9000, then:

alyxruntime stream --tunnel-token <TOKEN> --public-url https://gpu.example.com --port 9000 \
                   --allowed_ip 203.0.113.7

stream options

FlagMeaning
--allowed_ip IP [IP...]Public IPs / CIDR ranges (v4 or v6) allowed to connect, as seen by Cloudflare, or the word all (same as --allow-any). Required in tunnel mode.
--allow-anyAccept any IP (the token is then your only protection).
--no-tunnelSkip Cloudflare; listen directly on --host:--port (you handle NAT; loopback is always allowed in this mode).
--install-cloudflaredDownload cloudflared automatically if it’s missing.
--tunnel-token / --public-url / --portUse a named tunnel with a stable hostname (see above).
--gpus 0,1Share only these GPU indices (none = CPU only). Run several streams with different --gpus to give each client its own GPU.
--tokenFixed access token instead of a random one.
--root-dirDirectory the client can see (default: current dir).
--tls-cert / --tls-keyHTTPS for --no-tunnel mode (not needed with a tunnel).
--public-hostHostname/IP to print in the connect URL with --no-tunnel.

Security — please read

A runtime is remote code execution by design: whoever connects runs arbitrary code as the host user.

Web UI (Colab-style notebook)

alyxruntime connect <url>   # once (or use the Connect button in the UI)
alyxruntime ui              # opens http://127.0.0.1:8899 - notebook cells run on the remote GPU/CPU

Code/text cells, Shift+Enter / Ctrl+Enter, streaming output and plots, run all / interrupt / restart, remote file browser with upload/download, open/download .ipynb, dark mode. Notebooks autosave in the browser.

The UI only listens on 127.0.0.1 and requires a per-launch secret, so other websites can’t drive your runtime.

Example :