# Deploy and test Hanzo on your own machine

URL: https://docs.hanzo.ai/docs/self-hosting/quickstart

> A tested path to run Hanzo Cloud and a local model on your own hardware, check that both work, and move them to a machine with no network. Every command here was run, and the output shown is real.

This page takes you from nothing to a running Hanzo install on one Linux
machine, and shows you how to check that it works. Every command below was run
on 2026-11-29. The output under each command is what we saw. Anything we did not
run is marked **Not tested**.

If you only want a private model on your laptop, [Private AI on your own
machine](https://docs.hanzo.ai/docs/guides/private-ai) is shorter.

## What you get, and where each piece lives

A self-hosted install has two parts you run, and one tool you use to fetch models.

| Piece            | What it does                                                                                  | Source                                                | How you run it here                                                                         | Address            |
| ---------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------ |
| **Hanzo Cloud**  | The API server: `/v1` routes, health checks, the OpenAPI spec, and an MCP endpoint for agents | [`hanzoai/cloud`](https://github.com/hanzoai/cloud)   | Docker image `ghcr.io/hanzoai/cloud-oss:main`, started with the repo's `deploy/compose.yml` | `127.0.0.1:8080`   |
| **Hanzo Engine** | Runs open models on your CPU or GPU behind an OpenAI-compatible API                           | [`hanzoai/engine`](https://github.com/hanzoai/engine) | Built from source into one binary, `hanzo-engine`                                           | `127.0.0.1:1234`   |
| **Hanzo CLI**    | Downloads models (`hanzo pull`)                                                               | [`hanzoai/cli`](https://github.com/hanzoai/cli)       | `npm i -g hanzo`                                                                            | none (client only) |

```text
your app, curl, or an OpenAI SDK
   │
   ├──► 127.0.0.1:8080   Hanzo Cloud    (Docker container "hanzo-cloud")
   │         └── data in the Docker volume deploy_cloud-data, mounted at /var/lib/cloud
   │
   └──► 127.0.0.1:1234   Hanzo Engine   (hanzo-engine process)
             └── model files in ~/.cache/huggingface/hub, fetched by `hanzo pull`
```

The two parts do not talk to each other in this guide. Wiring Cloud's model
routes to your own engine is **Not tested** yet.

## Read this first: what works today

We are opening this stack up in public, and some edges are still rough. You
should know these before you start:

1. **Use the Docker image for Cloud, not a source build.** A clean build of
   `hanzoai/cloud` or `hanzoai/iam` from source stops with `could not read
   Username for 'https://github.com'`. Both depend on Go modules that are not
   public yet. The published image `ghcr.io/hanzoai/cloud-oss:main` needs none of
   that.
2. **Build the engine from source.** The engine you get from `npm i -g hanzo` is
   the older release v1.7.92. In our test it failed to load `zen-nano`
   (`shape mismatch for model.embed_tokens.weight`). The engine built from
   `main` worked.
3. **Cloud runs, but it does not store your data yet.** The health checks, the
   OpenAPI spec and the MCP tool list all work. The data routes we tried
   (`/v1/kv`, writes to `/v1/base`, `/v1/kms`) answered `503 audit_unavailable`. Every request that touches data must be written to
   an audit log first, and the service that keeps that log is not in the open
   image. Signing in with your own Hanzo IAM, which data routes also need, is
   **Not tested**. See [What is not covered yet](https://docs.hanzo.ai/docs/self-hosting/quickstart#what-is-not-covered-yet).

## What you need

|                    | Tested with                                        | Notes                                                                                                                                      |
| ------------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| OS                 | Debian 13, x86-64                                  | Other Linux distributions, macOS and Windows are **Not tested**.                                                                           |
| CPU and memory     | 8 cores, 16 GB RAM, no GPU                         | Cloud used about 600 MiB at idle. The engine peaked at about 4.1 GiB with `zen-nano`.                                                      |
| Disk               | About 20 GB free                                   | Cloud image: 7.3 GB. `zen-nano` model: 6.13 GiB. Engine build folder: 2.2 GB.                                                              |
| Docker             | Docker Engine 26.1.5 with Compose 2.26.1           | Needed for Cloud. Run `docker` as root or as a user in the `docker` group.                                                                 |
| Git, curl, OpenSSL | any recent version                                 | OpenSSL makes the encryption key.                                                                                                          |
| Rust               | stable, installed with [rustup](https://rustup.rs) | Needed for the engine. Its README asks for 1.88 or newer. We used gcc 14 as the C compiler.                                                |
| Node.js            | 24, with npm 11                                    | Needed for the CLI that downloads models.                                                                                                  |
| Network            | only for the downloads                             | After that, both parts run with no network. See [Run it air-gapped](https://docs.hanzo.ai/docs/self-hosting/quickstart#run-it-air-gapped). |

## Part 1: Run Hanzo Cloud

### Get the compose file

```bash
git clone --depth 1 https://github.com/hanzoai/cloud
cd cloud
```

You only need `deploy/compose.yml` from this repository. Nothing gets built.

### Make an encryption key

Cloud encrypts the data it stores with a key you hold. Make one in the `cloud`
folder and keep the file safe. The `hanzoai/cloud` README says stored data opens
only with the key that wrote it.

```bash
(umask 077 && openssl rand -base64 32 > master.key)
```

Give the key to the container. Save this as `compose.override.yml` in the
`cloud` folder:

```yaml title="compose.override.yml"
services:
  cloud:
    environment:
      CLOUD_KMS_MASTER_KEY_REF: ${CLOUD_KMS_MASTER_KEY_REF:?set it from master.key}
```

Without a key, Cloud started the first time but came back `unhealthy` after a
restart. With the key, it was healthy both times.

### Start it

```bash
export CLOUD_KMS_MASTER_KEY_REF="$(cat master.key)"
export HANZO_HTTP_PORT=127.0.0.1:8080 HANZO_METRICS_PORT=127.0.0.1:9090 HANZO_ZAP_PORT=127.0.0.1:9653
docker compose -f deploy/compose.yml -f compose.override.yml up -d
```

The three `HANZO_*_PORT` lines keep every port on `127.0.0.1`. Leave them out
and the compose file publishes ports 8080, 9090 and 9653 on every network
interface, so other machines on your network can reach Cloud.

If you run Docker through `sudo`, put the variables after `sudo`, because
`sudo` drops your exported ones. We ran it this way:
`sudo CLOUD_KMS_MASTER_KEY_REF="$(cat master.key)" HANZO_HTTP_PORT=127.0.0.1:8080 HANZO_METRICS_PORT=127.0.0.1:9090 HANZO_ZAP_PORT=127.0.0.1:9653 docker compose -f deploy/compose.yml -f compose.override.yml up -d`.

The first `up` downloads the 7.3 GB image. That took under 3 minutes on our
connection.

### Wait until it is healthy

The compose file has a health check. It runs a probe that ships inside the image.
Wait until the status reads `(healthy)`. That took about 35 seconds for us.

```bash
docker compose -f deploy/compose.yml ps
```

```text
NAME          IMAGE                            ...   STATUS                   PORTS
hanzo-cloud   ghcr.io/hanzoai/cloud-oss:main   ...   Up 41 seconds (healthy)   127.0.0.1:8080->8080/tcp, 127.0.0.1:9090->9090/tcp, 127.0.0.1:9653->9653/tcp
```

Checks sent before then can answer `503` with `mount /v1: no instance running`.
That only means Cloud is still starting.

## Verify Cloud works

Run the same probe yourself:

```bash
docker compose -f deploy/compose.yml exec cloud /smoke -class health -base http://127.0.0.1:8080 -timeout 5
```

```text title="output (separator lines trimmed)"
      SUBSYSTEM               STATUS    PATH
PASS  base-health             200       /v1/base/health
PASS  ready                   200       /readyz
PASS  health                  200       /v1/health
3 passed, 0 failed, 3 total

SMOKE PASS: every core subsystem returned a working code (no 402-on-read, no 5xx)
```

Or check each route with `curl`:

```bash
curl -s http://127.0.0.1:8080/v1/health
```

```json
{"revision":"8f2725d58e0fc7218d457aa7f9d40eab1b386c4f","status":"ok"}
```

`revision` is the `hanzoai/cloud` commit the image was built from.

```bash
curl -s http://127.0.0.1:8080/v1/base/health
```

```json
{"service":"base","status":"ok"}
```

```bash
curl -s http://127.0.0.1:8080/readyz
```

```json
{"absent":{"s3":"exited before listening: exit status 1"},"status":"ok"}
```

`absent` lists the parts that did not start. Object storage (`s3`) does not
start in this image yet. Everything else above still works without it.

See every route this server has:

```bash
curl -s -o openapi.json -w "%{http_code}\n" http://127.0.0.1:8080/v1/openapi.json
```

```text
200
```

List the tools an agent sees over MCP:

```bash
curl -s http://127.0.0.1:8080/v1/mcp -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

The answer is JSON-RPC with a `result.tools` list. We got 127 tools.

### What you will see if you try to store data

```bash
curl -s http://127.0.0.1:8080/v1/kv/demo/hello
```

```json
{"error":{"code":"audit_unavailable","message":"Request could not be securely recorded"}}
```

That is expected today. Cloud records every request that touches data in an
audit log before it runs, and it refuses the request when it cannot. The
service that keeps the log is not in the open image yet.

### Stop, restart, remove

| To                          | Run                                                         |
| --------------------------- | ----------------------------------------------------------- |
| Stop and keep your data     | `docker compose -f deploy/compose.yml down`                 |
| Start again                 | the `up -d` command from step 3, with the same `master.key` |
| Delete everything, data too | `docker compose -f deploy/compose.yml down -v`              |

## Part 2: Run a model with Hanzo Engine

### Build the engine

```bash
git clone --depth 1 https://github.com/hanzoai/engine
cd engine
cargo build --locked --release -p hanzo-cli
```

This took 5 minutes on 8 cores, starting from an empty Cargo cache. The result
is one file, `target/release/hanzo-engine` (134 MB). `ldd` shows it links only
the system libraries `libc`, `libm` and `libgcc_s`.

### Download a model

```bash
npm i -g hanzo
export HANZO_TELEMETRY=0
hanzo pull zen-nano
```

- `HANZO_TELEMETRY=0` stops the CLI from sending a usage event after each command.
- `zen-nano` is short for `zenlm/zen-nano-0.6b`, a small model that runs on any
  machine. The download is 35 files, 6.13 GiB, into `~/.cache/huggingface/hub`.
  It took about 3 minutes for us.
- npm 11 may warn that a postinstall script was not run. `hanzo pull` worked anyway.

```bash
hanzo engine list
```

```text
MODEL                                              SIZE  REV
zenlm/zen-nano-0.6b                            6.13 GiB  442ced4e
```

### Serve it on loopback only

From the `engine` folder:

```bash
HF_HUB_OFFLINE=1 ./target/release/hanzo-engine serve \
  --host 127.0.0.1 -p 1234 --no-advertise \
  --served-model-name zen-nano -m zenlm/zen-nano-0.6b --cpu --dtype f32
```

- `--host 127.0.0.1` keeps it off your network. The default is every interface.
- `--no-advertise` turns off its mDNS announcement.
- `HF_HUB_OFFLINE=1` makes it read only the files you already downloaded.

It is ready when the log says `Server listening on http://127.0.0.1:1234`.
That took about 8 seconds. Leave this terminal open.

## Verify the engine works

In a second terminal:

```bash
curl -s http://127.0.0.1:1234/v1/models
```

```json
{"object":"list","data":[{"id":"zen-nano","object":"model","created":1795991075,"owned_by":"local","status":"loaded"}]}
```

```bash
curl -s http://127.0.0.1:1234/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"zen-nano","messages":[{"role":"user","content":"What is 2+2? Answer in one short sentence."}],"max_tokens":60}'
```

The reply is in `choices[0].message.content`. Ours was `"\n\n2 + 2 = 4."`, after
about 9 seconds on CPU. Any OpenAI client can use `http://127.0.0.1:1234/v1` as
its base URL.

The engine also serves a chat page at `http://127.0.0.1:1234/ui`.

## Run it air-gapped

Do the downloads on a machine with network, then carry three things across.

**1. The Cloud image.** On the connected machine:

```bash
docker save ghcr.io/hanzoai/cloud-oss:main -o cloud-oss-main.tar
```

On the offline machine:

```bash
docker load -i cloud-oss-main.tar
```

The file is 7.3 GB. Loading it took 29 seconds. Also copy the `cloud` folder (for
`deploy/compose.yml`), your `compose.override.yml`, and `master.key`.

**2. The engine.** Copy `target/release/hanzo-engine`. Running a copy on a
second machine is **Not tested**; we ran it on the machine that built it.

**3. The model.** Copy `~/.cache/huggingface/hub/models--zenlm--zen-nano-0.6b` to
the same place on the offline machine. [Run it offline](https://docs.hanzo.ai/docs/guides/private-ai/offline)
shows how to package and check it.

What we checked with no network:

- Cloud, started with `docker run --network none` from the loaded image, came up
  and answered `/healthz` and `/v1/base/health` with `200`.
- The engine, started in a Linux network namespace with nothing but loopback,
  loaded `zen-nano` and answered a chat request.

One thing to change for air-gapped use: `deploy/compose.yml` sets
`HANZO_IAM_ISSUER` to `https://hanzo.ai` unless you set it. Point it at your own
identity server, or leave it unused while data routes are unavailable.

## Configuration

These are the settings this guide uses. Each one was set and run.

| Setting                                                   | Where                | What it does                                                                             |
| --------------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------------- |
| `CLOUD_KMS_MASTER_KEY_REF`                                | Cloud container      | The encryption key for stored data. Keep it; data opens only with the key that wrote it. |
| `HANZO_HTTP_PORT`, `HANZO_METRICS_PORT`, `HANZO_ZAP_PORT` | `docker compose`     | Host side of each published port. Add `127.0.0.1:` to keep a port off your network.      |
| `--host`, `-p`                                            | `hanzo-engine serve` | Address and port.                                                                        |
| `--no-advertise`                                          | `hanzo-engine serve` | No mDNS announcement.                                                                    |
| `--cpu`, `--dtype f32`                                    | `hanzo-engine serve` | Run on CPU with 32-bit weights.                                                          |
| `HF_HUB_OFFLINE=1`                                        | engine               | Use downloaded model files only.                                                         |
| `HANZO_TELEMETRY=0`                                       | `hanzo` CLI          | No usage events.                                                                         |

`deploy/compose.env.example` in `hanzoai/cloud` lists the rest of the compose
settings. We did not test those.

## Production and Kubernetes

**Not tested.** This guide covers one machine. `hanzoai/cloud/deploy/README.md`
describes a native engine pool behind Cloud's gateway, and says Kubernetes
deployments are kept elsewhere. We have not run either. Ask us before you plan a
production rollout (see [Get help](https://docs.hanzo.ai/docs/self-hosting/quickstart#get-help)).

## Troubleshooting

| You see                                                                                            | Why                                                      | Fix                                                                                                                        |
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `could not read Username for 'https://github.com'` while building `hanzoai/cloud` or `hanzoai/iam` | They depend on Go modules that are not public yet        | Use the Docker image (Part 1).                                                                                             |
| `Error: shape mismatch for model.embed_tokens.weight` from `hanzo engine serve`                    | The engine npm installs (v1.7.92) cannot load `zen-nano` | Build the engine from source (Part 2).                                                                                     |
| `503` `mount /v1: no instance running`                                                             | Cloud is still starting                                  | Wait for `(healthy)` in `docker compose ps`.                                                                               |
| Container goes `unhealthy` after a restart                                                         | No encryption key was set                                | Set `CLOUD_KMS_MASTER_KEY_REF` (step 2).                                                                                   |
| `503` `audit_unavailable`                                                                          | The audit log service is not in the open image           | Expected today. See [What is not covered yet](https://docs.hanzo.ai/docs/self-hosting/quickstart#what-is-not-covered-yet). |
| `/readyz` lists `s3` under `absent`                                                                | Object storage does not start in this image              | Expected. The rest still works.                                                                                            |
| `http://127.0.0.1:8080/` answers `503`                                                             | The open image ships no web console                      | Use the API routes above.                                                                                                  |
| `Cannot connect to the Docker daemon`                                                              | Docker is not running, or your user cannot reach it      | Start Docker, or use `sudo` / the `docker` group.                                                                          |

## What is not covered yet

These are open, and this page will grow as each one lands:

- **Storing data in Cloud.** It needs the audit log service in the open image,
  and a sign-in token from a Hanzo IAM you run.
- **Running your own Hanzo IAM.** There is no tested path yet: its source build
  needs Go modules that are not public.
- **Connecting Cloud's `/v1` model routes to your engine.**
- **A fixed image version.** `cloud-oss:main` moves with the `main` branch. We
  tested the build of commit `8f2725d`.
- **macOS, Windows, GPUs, and models other than `zen-nano`.**

## What was tested

Run on 2026-11-29 on Debian 13 x86-64, with 8 cores, 16 GB RAM and no GPU.

| Item                             | Version                                                                                                         |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `ghcr.io/hanzoai/cloud-oss:main` | `sha256:5fd1ffc1ee57c03651addc2aeae969bd8f162809f047eb7da45a14067c3b1099`, built from `hanzoai/cloud` `8f2725d` |
| `hanzoai/engine`                 | `main` at `4a6cd9a`, `hanzo-engine` 1.7.109                                                                     |
| `hanzo` CLI                      | 8.5.1496 from npm                                                                                               |
| Docker                           | Engine 26.1.5, Compose 2.26.1                                                                                   |
| Rust                             | stable, cargo 1.100.1                                                                                           |

The engine build and the model download ran in a fresh home folder, with no
GitHub sign-in and empty Cargo and Hugging Face caches. The source builds of
`hanzoai/cloud` and `hanzoai/iam` that failed ran the same way.

## Get help

- **Discord:** [discord.gg/XthHQQj](https://discord.gg/XthHQQj) reaches the
  engineers who build Cloud and the engine.
- **GitHub issues:** [`hanzoai/cloud`](https://github.com/hanzoai/cloud/issues),
  [`hanzoai/engine`](https://github.com/hanzoai/engine/issues), or
  [`hanzoai/docs`](https://github.com/hanzoai/docs/issues) when this page is wrong.
- **Deployment help:** <enterprise@hanzo.ai>.

For everything else in the open-source stack, see the [Self-Hosting & Air-Gapped
reference](https://docs.hanzo.ai/docs/self-hosting).
