Skip to main content

matmul-cloud

The command line tool and Python SDK for MatMul. Rent a GPU from the cheapest live offer across the neoclouds, run your container image on it, SSH in, and stop paying when you're done. One account, one prepaid balance.

The package is called matmul-cloud on PyPI. It installs the matmul command, and you import it as matmul. It uses only the Python standard library, so it installs in seconds and won't conflict with anything in your environment. Python 3.9 or newer.

Install

pip install matmul-cloud        # or: pipx install matmul-cloud
matmul --version

Log in

Create an API key on the CLI & API page of the console: https://app.matmul.cloud/app/cli. The key is shown once, with a ready-made login command:

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

That saves the key to ~/.config/matmul/config.json, readable only by you. In CI, set MATMUL_API_KEY in the environment instead. MATMUL_API_URL overrides the API base URL.

Rent a GPU from the command line

matmul ssh-key add                        # registers ~/.ssh/id_ed25519.pub (or --file)
matmul offers --gpu H100                  # live offers, cheapest first
matmul instance create --name dev --gpu H100 --max-price 3 --wait
matmul ssh dev -- nvidia-smi
matmul instance rm dev                    # releases the machine; billing stops

--max-price is a hard ceiling in dollars per hour: if the live price has moved above it, nothing is launched and nothing is charged. Run matmul --help, or matmul <command> --help, for every command and flag.

Use it from Python

import matmul

client = matmul.Client()  # MATMUL_API_KEY, or the key saved by `matmul login`

offers = client.offers(gpu="H100", max_price_cents=300)
offer = offers[0]
key = client.ssh_keys()[0]

inst = client.create_instance(
    offer.id, "sdk-demo", image=None, ssh_key_id=key.id,  # image=None: a plain VM
    max_hourly_price_cents=300,
)
try:
    inst = client.wait_instance(inst.id)
    print("ssh:", inst.ssh_command)
finally:
    client.delete_instance(inst.id)  # always stop billing

Failures raise matmul.MatMulError, with .status (the HTTP status) and .message.

Changelog

0.1.0

First release on PyPI.

  • GPU instances: offers, ssh-key add/ls/rm, instance create/ls/get/rm, ssh, and public HTTPS links for ports (expose, unexpose, ports).
  • Prepaid billing: billing balance, billing ledger, billing add-credit.
  • Managed jobs (preview): run with --gpu, --max-price and --wait, plus ls, status, logs and down.
  • matmul --version.

Release files for matmul-cloud 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matmul-cloud 0.1.0
File Size Uploaded
matmul_cloud-0.1.0.tar.gz 30.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matmul-cloud 0.1.0
File Interpreter ABI Platform
matmul_cloud-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 54.0 kB

Release files / matmul_cloud-0.1.0.tar.gz

Download URL matmul_cloud-0.1.0.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
13534870b49dedbe265ddd2dd262cb2321f321220f7ecff18e41000a25159850
BLAKE2b-256 checksum
How to use checksums
546c34da67e1ea1723293de99e6e185f6cbc21360ec6e726789ed4ed8e9fc8fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / matmul_cloud-0.1.0-py3-none-any.whl

Download URL matmul_cloud-0.1.0-py3-none-any.whl
Size 23.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40f0ec34758db3e8290de4a3fed056bcdcf387518d763612ab30e3512dcec70c
BLAKE2b-256 checksum
How to use checksums
96aeb69bc37e80515b5b8d5f6fb8218121c72b00503329b4376739e057346d1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page