Installation
belfort-ml and belfort-ml-client import as belfort_ml and
belfort_ml_client. Both depend on belfort-ml-bucket, the models
bucket layout they share; neither depends on the other.
belfort-ml#
In a virtual environment with Python 3.12 or newer, e.g. created with
uv venv --python 3.12:
uv pip install --torch-backend=cpu belfort-mlWith pip, take torch from PyTorch's CPU index; on Linux, the default index
would pull the CUDA build:
pip install --extra-index-url https://download.pytorch.org/whl/cpu belfort-mlIt pulls in torch, belfort-torch-mlir, httpx
and belfort-ml-bucket. Compiling runs on the CPU, on macOS on Apple Silicon
or Linux (x86-64 or ARM).
An API key#
Sign in to the Belfort console at eml.belfortlabs.com,
open API keys, and create one. The key (blf_live_...) is shown once. An
account holds up to five active keys.
Keep the key out of source. The SDK reads it from the environment:
export BELFORT_API_KEY=blf_live_...Check the key with belfort-ml:
import belfort_ml
with belfort_ml.Provider() as provider:
account = provider.account.get()
print(account["mp_id"], account["credits"]["available"])A new account starts with a few credits; Deploys and credits has the details.
The Belfort ML client#
uv pip install belfort-ml-client
# or: pip install belfort-ml-clientTo run the client yourself while testing, as the Quickstart
does, install it next to belfort-ml.
The Belfort ML client compiles the client-side C++ generated for your model and links it against the Cyclops client library. It needs no GPU; the machine needs:
- macOS 14 or newer on Apple Silicon, or Linux (x86-64 or ARM) on a recent distribution. On ARM, encryption and decryption are slower than on x86-64.
- A C++20 compiler
On these platforms belfort-ml-client installs a platform wheel
that contains the Cyclops client library and its headers, with libtommath
linked in. Neither a Cyclops build nor libtommath needs to be installed.
The Belfort ML client covers running it.