---
description: Install belfort-ml and belfort-ml-client, and get an API key.
---

# 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`:

```bash
uv pip install --torch-backend=cpu belfort-ml
```

With pip, take `torch` from PyTorch's CPU index; on Linux, the default index
would pull the CUDA build:

```bash
pip install --extra-index-url https://download.pytorch.org/whl/cpu belfort-ml
```

It 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](https://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:

```bash
export BELFORT_API_KEY=blf_live_...
```

Check the key with `belfort-ml`:

```python title="check_key.py"
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](../concepts/deploys-and-credits.md) has the details.

## The Belfort ML client

```bash
uv pip install belfort-ml-client
# or: pip install belfort-ml-client
```

To run the client yourself while testing, as the [Quickstart](quickstart.md)
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](../sdk/belfort-ml-client.md) covers running it.
