// GETTING STARTED

How to rent a cloud GPU in 5 minutes with MatMul

Rent a cloud GPU from your terminal. Log in, add an SSH key, pick a live offer, launch a VM or Docker image, SSH in, and delete it to stop billing.

· 6 min read

· MatMul team

Renting a GPU shouldn't mean opening accounts with five providers, comparing price pages that went stale last week, and learning a new console each time. MatMul puts live GPU offers from across the neocloud market behind one CLI, one API and one prepaid balance. You pick an offer, get a machine, and SSH in.

This guide goes from zero to a shell on a cloud GPU. The only waiting is while the provider boots the machine. You'll need:

  • a MatMul account (sign in at the console; we're in early access, so new accounts may wait briefly for approval),
  • Python 3.9 or newer, for the matmul CLI,
  • an SSH key pair. If you don't have one, ssh-keygen -t ed25519 makes one.

Everything below also works in the console with buttons. We use the CLI here because the commands are easy to copy, and they're the same ones you'll script later.

1. Install the CLI and log in

The CLI is a small Python package on PyPI, matmul-cloud, with no dependencies. It installs the matmul command. Install it with pip (or pipx install matmul-cloud if you'd rather keep it in its own environment):

bash
pip install matmul-cloud

On the same page, click Create key. The key is shown once, together with a ready-made login command. Run it:

bash
matmul login --api-key lmk_... --url https://api.matmul.cloud

That saves the key to ~/.config/matmul/config.json, readable only by you. If you'd rather not store it on disk, for example in CI, set MATMUL_API_KEY in the environment instead. The CLI and the Python SDK both read it.

2. Register your SSH key

Machines only accept the SSH keys you've registered. Add your public key once:

bash
matmul ssh-key add

With no arguments it uploads ~/.ssh/id_ed25519.pub, falling back to id_ecdsa.pub and then id_rsa.pub. Use --file to pick another key and --name to label it. matmul ssh-key ls lists your keys. Only the public half ever leaves your laptop.

3. Find a GPU at the floor price

Offers change minute to minute as providers gain and lose capacity, so they come from live availability, not from a price list someone updated last week:

bash
matmul offers --gpu H100

You get a table with the GPU count and model, VRAM per GPU, vCPUs, RAM, region, hourly price and an offer ID, cheapest first. You can narrow it down:

bash
matmul offers --gpu A100 --count 2          # machines with 2x A100
matmul offers --gpu L40S --max-price 2.5     # only offers at or under $2.50/hr
matmul offers --gpu H100 --region <region>  # one region, as shown in the REGION column

We won't quote prices in this post, because they'd be out of date by the time you read it. The live price ticker on our homepage and matmul offers both show what you'd pay right now. The hourly price in the table is the price you're billed.

Which GPU should you pick? Go by memory first. If your model or batch doesn't fit in VRAM, nothing else matters. The vLLM guide has a rule of thumb for sizing inference. For experiments, the cheapest GPU with enough VRAM is usually the right call, because you can always relaunch on something bigger.

4. Launch: a plain VM or your Docker image

There are two ways to launch, and choosing between them is the one real decision in this guide.

Option A: the plain VM

Leave out --image and you get the provider's own machine image: Ubuntu with the NVIDIA drivers and CUDA installed. SSH lands directly on it, with no container in the way. This is the simplest setup, and the right default if you want a GPU box to work on.

bash
matmul instance create --name dev --gpu H100 --wait

--gpu H100 picks the cheapest H100 offer available right now and prints which one it chose. If you want an exact offer, pass --offer <OFFER ID> from the table instead. To make sure a price change between looking and launching can't surprise you, add a ceiling:

bash
matmul instance create --name dev --gpu H100 --max-price 3 --wait

If no offer is at or under your ceiling, the launch is refused and nothing is billed.

Option B: your Docker image

Pass --image and your image runs as a container on the machine, with the GPUs available to it. Any public image works: pytorch/pytorch, nvidia/cuda, or your own.

bash
matmul instance create --name nb --gpu H100 \
  --image pytorch/pytorch:latest --keep-alive --wait

About --keep-alive: many images, including ubuntu and pytorch/pytorch, have no long-running command. They start, find nothing to do, and exit. --keep-alive keeps the container running so you can shell into it. Leave it off for images that start their own server, such as an inference server. Those stay up on their own, and you pass their arguments with --args.

Other launch options you'll use often:

  • --env KEY=VALUE (repeatable) sets environment variables in the container.
  • --port 8888 (repeatable) publishes a container port on the machine.
  • --shm 16 gives the container 16 GB of shared memory. PyTorch data loaders and multi-GPU inference often need more than Docker's default.

Waiting for the machine

With --wait, the CLI polls until the instance is running and then prints the SSH command. Provisioning a real GPU host often takes several minutes, and depends on the provider, so the CLI shows elapsed time while it waits. Without --wait the command returns right away, and you can check the status any time:

bash
matmul instance ls

5. SSH in

bash
matmul ssh dev

On a plain VM this opens a shell on the machine. On an instance launched with an image, matmul ssh puts you inside the container, because that's almost always where you want to be. Use --host for the VM underneath. Run a single command by putting it after --:

bash
matmul ssh dev -- nvidia-smi
matmul ssh --host nb                # the VM, not the container

If you'd rather use plain ssh, scp or your editor's remote mode, the --wait output and the instance page in the console show the raw SSH command with the machine's user, IP and port. For a plain VM, matmul instance get dev shows it too.

6. Billing: prepaid credit, no surprises

MatMul bills from a prepaid balance. Top it up in the console or from the terminal:

bash
matmul billing add-credit --usd 20   # prints a Stripe checkout link
matmul billing balance
matmul billing ledger                # charges and top-ups

While an instance runs, it's charged its hourly price for the time it's up. matmul instance ls shows each instance's running time and cost so far. Some guardrails to know about:

  • Low balance. When your balance is about to run out at the current burn rate, we email you a warning.
  • Zero balance. At zero the account is frozen: new launches are blocked, and the CLI shows a warning above your instance list. After a grace period, instances that are still running are terminated so the balance can't go far negative. Topping up unfreezes the account straight away.
  • New accounts start with lower limits, such as one instance at a time. They lift after a bank-verified card payment or a quick review. matmul billing balance shows yours.

7. Delete the instance to stop billing

This is the step people forget. An instance bills until you delete it, whether or not you're using it:

bash
matmul instance rm dev

The machine is released back to the provider and billing stops. Anything on its disk is gone, so copy results off first, with scp or by pushing to object storage or your model hub.

The whole thing, in one block

bash
pip install matmul-cloud
matmul login --api-key lmk_... --url https://api.matmul.cloud
matmul ssh-key add
matmul offers --gpu H100
matmul instance create --name dev --gpu H100 --max-price 3 --wait
matmul ssh dev -- nvidia-smi
matmul instance rm dev

Where to go next

  • Run an app with a web UI, such as ComfyUI, and reach it from your browser: Run ComfyUI on a cloud GPU.
  • Serve an open-source model behind an OpenAI-compatible API: Serve an LLM with vLLM.
  • Script all of this from Python or plain HTTP: Build on MatMul.

If something doesn't work the way this post says, email support@matmul.cloud. We're early, and we read everything.

All posts