# Private AI on your own machine

URL: https://docs.hanzo.ai/docs/guides/private-ai

> Install the Hanzo CLI, pull an open model, serve it on loopback only, and check that nothing leaves the machine. No account, no Docker.

This guide runs an open model on your own computer and talks to it over a
local HTTP API. When you follow it as written:

- the model answers from your machine, with no Hanzo account;
- the server listens on `127.0.0.1` only, so other devices on your network cannot reach it;
- the CLI sends no usage events;
- after the model and engine downloads, it works with the network unplugged.

Each of those was checked on Linux. The receipts, and what was not run, are at
the end of this page, in [What was checked](https://docs.hanzo.ai/docs/guides/private-ai#what-was-checked).

## What you need

|                  | Needs                                                                                                                                         |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Operating system | macOS (Apple silicon or Intel) or Linux (x86-64 or ARM64). Windows has no prebuilt engine, so this guide does not cover it yet.               |
| Node.js          | 18 or newer, for `npm i -g hanzo`.                                                                                                            |
| Disk             | 6.13 GiB for `zen-nano`. `hanzo pull` downloads every file in the model repository: the safetensors weights plus all its GGUF and MLX copies. |
| Memory           | About 4 GiB at peak, measured on a 4-core CPU-only Linux machine with 16 GB RAM.                                                              |
| GPU              | Not needed. The run below was CPU only.                                                                                                       |
| Network          | Only for the install, the model download, and the engine download on the first `hanzo engine serve`.                                          |

## Install the CLI

```bash
npm i -g hanzo
```

This installs `hanzo`. The local engine is a separate binary. The first
`hanzo engine serve` downloads it from the latest
[`hanzoai/engine` release](https://github.com/hanzoai/engine/releases) that has a
build for your platform. The launcher checks a SHA-256 only when the release
publishes a `.sha256` file, and engine releases do not, so this download is not
checksum-checked.

> `curl -fsSL https://hanzo.sh | sh` installs `hanzo` too, but it does not
> install the engine, and `hanzo engine serve` then stops with `engine not found`.
> Use npm for this guide.

## Turn off CLI usage events

By default the CLI sends a usage event (the command, how long it took, whether it
failed) to `api.hanzo.ai` after each command. That includes commands that are
otherwise local, like `hanzo engine list`. Turn it off for this shell:

```bash
export HANZO_TELEMETRY=0
```

`DO_NOT_TRACK=1` works too. Add the line to your shell profile (`~/.zshrc` or
`~/.bashrc`) to keep it off.

## Pull a model

```bash
hanzo pull zen-nano
```

`zen-nano` is short for `zenlm/zen-nano-0.6b`. The files go into the standard
Hugging Face cache, `~/.cache/huggingface/hub` (or the folder `HF_HUB_CACHE` or
`HF_HOME` points at), which other tools can share. If the `hf` or
`huggingface-cli` tool is installed, `hanzo pull` hands the download to it.

The last line `hanzo pull` prints suggests a serve command without
`--serve-ip`. Use the one in step 4 instead.
Check what you have:

```bash
hanzo engine list
```

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

## Serve it on loopback only

> On 2026-11-29 we ran this step with the engine that `npm i -g hanzo` actually downloads (release v1.7.92). It stopped with `Error: shape mismatch for model.embed_tokens.weight`. The engine built from `hanzoai/engine` `main` loaded `zen-nano` and answered. Until a new release ships, build the engine from source as shown in [Deploy and test Hanzo on your own machine](https://docs.hanzo.ai/docs/self-hosting/quickstart#part-2-run-a-model-with-hanzo-engine).

```bash
HF_HUB_OFFLINE=1 hanzo engine serve zen-nano -- --serve-ip 127.0.0.1
```

- `--serve-ip 127.0.0.1` matters. Without it the engine listens on every network
  interface (`0.0.0.0`), so anyone on your Wi-Fi can use your model.
- `HF_HUB_OFFLINE=1` tells the engine to use only the files already in the cache
  and never contact Hugging Face.
- The port is `1234`. To change it, put `-p <port>` after the `--`.

The command runs in the foreground. Leave this terminal open. The model stops
when you close it or press Ctrl-C, and does not answer while the machine sleeps.

## Talk to it

In a second terminal:

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

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

The reply is in `choices[0].message.content`. Anything that speaks the OpenAI chat
API can use `http://127.0.0.1:1234/v1` as its base URL. The key can be any string.

`zen-nano` is a 0.6B model. It is small enough for any laptop, and that also
limits what it can do. Expect short answers.

## Check that nothing leaves

On macOS or Linux, this lists every socket the engine has open:

```bash
lsof -nP -iTCP -iUDP -a -p "$(pgrep -f 'hanzoai --port')"
```

You should see one line, `TCP 127.0.0.1:1234 (LISTEN)`, plus a line for each
connection your own `curl` has open. A line with `*:1234`, or a connection to an
outside address, means a step above was skipped.

To check offline operation itself, see [Run it offline](https://docs.hanzo.ai/docs/guides/private-ai/offline).

## Stop, remove, undo

| To                        | Do                                                                                                                                                                                           |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Stop the model            | Ctrl-C in the serving terminal.                                                                                                                                                              |
| Free the disk             | `rm -rf ~/.cache/huggingface/hub/models--zenlm--zen-nano-0.6b ~/.cache/huggingface/hub/zenlm-zen-nano-0.6b_repo_list.json` (this deletes the download; you need the network to get it back). |
| Remove the CLI and engine | `npm uninstall -g hanzo`                                                                                                                                                                     |

Nothing in this guide changes system settings, installs a background service or
opens a firewall port, so these three steps undo it.

## Limits

These are not part of this guide, either because the code has not shipped or because this guide was not written from its source:

- **Hanzo Desktop.** Its installers are published on the
  [`hanzoai/desktop` releases](https://github.com/hanzoai/desktop/releases), but
  the app is built from a separate repository whose source this guide was not
  written from, so it does not cover Desktop or a private mode in it.
- **An agent or a daily brief on top of the local model.** `hanzo bot` talks to
  the local engine, but the `hanzo-bot` runtime it needs has no installer in the
  CLI, so it is not a step anyone can follow yet.
- **Asking before a request goes to the cloud** ("hybrid" mode), and a deployment
  policy for teams. The contract for those is still being written in
  [hanzoai/hips#33](https://github.com/hanzoai/hips/issues/33).
- **The browser chat page at `/ui`.** The engine that npm installs does not serve
  it (it returns 404). Only an engine built from source does.
- **Checking that the engine binary is genuine.** Nothing checks it today. The
  download has no checksum (step 1). Engine releases may carry cosign `.sig` and
  `.pem` files, but the release workflow ships a file unsigned when signing
  fails. `hanzo doctor --verify` checks `hanzo`, `dev`, `gen`, `hanzo-mcp` and
  `zt`, not the engine.
- **Updating the engine.** A new `hanzo pull zen-nano` fetches the model's
  current revision. There is no tested way yet to update the engine binary that
  npm downloaded.

## What was checked

All of it ran on 2026-11-29 on a fresh home directory on Linux x86-64 (4 CPU
cores, 16 GB RAM, no GPU), with `hanzo` built from
[`hanzoai/cli`](https://github.com/hanzoai/cli) at `030a332` (v8.5.1496) and the
engine built from [`hanzoai/engine`](https://github.com/hanzoai/engine) at
`dbac7a6`. The npm install was simulated by placing that engine under its
release name `hanzoai` next to the adapter script that `npm/install.js` writes,
byte for byte.

Not run:

- the npm download itself, because this machine could not reach GitHub release
  downloads;
- the released engine binary. npm downloads one built from a release tag (its
  fallback is `v1.7.92`), not from `dbac7a6`. The `--serve-ip` flag and the
  missing `/ui` route were read in `v1.7.92`'s source, not run;
- macOS. The release workflow builds macOS only when a macOS runner is online,
  so a release may have no macOS build.

| Claim                                                                                           | How it was checked                                                                  | Source                                                                                                                             |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| The CLI sends usage events by default, even for local commands                                  | A logging proxy recorded `CONNECT api.hanzo.ai:443` for `hanzo engine list`         | `cli: src/telemetry.rs`                                                                                                            |
| `HANZO_TELEMETRY=0` or `DO_NOT_TRACK=1` stops them                                              | The same proxy recorded no connection                                               | `cli: crates/event/src/lib.rs` `is_opt_out`                                                                                        |
| The engine is fetched on the first `hanzo engine serve`, macOS and Linux only, with no checksum | Read                                                                                | `cli: npm/bin/hanzo.js`, `npm/install.js` `fetchEngine`; `engine: .github/workflows/release.yml` at `v1.7.92` uploads no `.sha256` |
| `hanzo.sh` does not install the engine                                                          | Ran `hanzo engine serve` with no engine on `PATH`: `Error: engine not found`        | `cli: src/commands/engine.rs` `engine_bin`, which only looks on `PATH` and `HANZO_ENGINE_BIN`                                      |
| `hanzo pull zen-nano` downloads 35 files, 6.13 GiB                                              | Ran it                                                                              | `cli: src/commands/engine.rs` `pull_native_hf`                                                                                     |
| Without `--serve-ip` the engine listens on `0.0.0.0:1234`                                       | Read the listening socket from `/proc/net/tcp`                                      | `engine: hanzo-server/src/main.rs`                                                                                                 |
| With `-- --serve-ip 127.0.0.1` it listens on `127.0.0.1:1234` only and answers                  | Ran it; `/v1/models` and `/v1/chat/completions` replied                             | as above                                                                                                                           |
| `-- --host 127.0.0.1 --no-advertise` fails on this engine                                       | Ran it: `error: unexpected argument '--host' found`                                 | `--host` and `--no-advertise` belong to the source-built `hanzo-engine`                                                            |
| `HF_HUB_OFFLINE=1` uses the cache only                                                          | Served and answered inside a Linux network namespace with no interface but loopback | `engine: hanzo-engine/src/pipeline/hf.rs`                                                                                          |
| Peak memory about 4 GiB                                                                         | `VmHWM` 4,247,056 kB for the serving process after one reply                        | measured                                                                                                                           |
| `/ui` returns 404 on this engine                                                                | `curl`                                                                              | no `/ui` route in `hanzo-server`                                                                                                   |
| No conversation is written to disk                                                              | No new files outside the model cache after serving                                  | measured                                                                                                                           |
