# Run a node & earn

# Run a node & earn

Have a GPU — a gaming card, a Mac with lots of unified memory, or a cluster? Serve models on Porten and get paid for the tokens you produce. A node is a small agent (`porten`) that runs an inference engine and streams results back to the Hub.

## Install in one line

On any Mac or Linux box:

```bash
curl -fsSL https://porten.ai/install.sh | sh
```

It downloads the agent, picks an engine (uses [Ollama](https://ollama.com) if it's running, otherwise the built-in engine), enrolls the machine **through your browser** — you approve it in the portal, no token to paste — and installs the background service. On a Mac it installs the [desktop app](/download) instead.

That's it: the machine appears under **Earn** and starts serving.

## How enrollment works (browser login)

`porten login` prints a short code and a URL. Open it on any device, sign in, and approve the machine — its key is bound to your account at that moment. The agent then keeps a persistent connection to the Hub and registers what it can serve; the Hub routes matching requests to it, and you're paid per token (see Payouts in the portal).

No screen on the box? Fine — the link prints in the terminal and you approve it from your phone or laptop.

## Engines

`porten` supports several back-ends — pick the one that matches your setup:

| Engine | Use when | Notes |
|---|---|---|
| `builtin` | Single box, you want the Hub to manage models | Runs `llama-server`; **auto-downloads** GGUF weights from the catalog's `download_ref` and loads/unloads on demand. This is what powers on-demand loading. |
| `ollama` | You already run [Ollama](https://ollama.com) | The agent advertises an allow-list of your Ollama models. |
| `openai` | You front a runtime that exposes an OpenAI endpoint | e.g. an [exo](/docs/cluster-thunderbolt) Mac cluster, vLLM, or llama.cpp server. |

## Configuration

The installer picks sensible defaults. To tune them, set env vars **before** `porten service install` (they're baked into the service unit):

```bash
export PORTEN_ENGINE=builtin            # builtin | ollama | openai
export PORTEN_VRAM_BUDGET_MB=24000      # how much VRAM the agent may use
export PORTEN_AUTO_DOWNLOAD_MB=200000   # disk budget for cached weights
```

For an Ollama node, set `PORTEN_ENGINE=ollama` and an allow-list (`PORTEN_ENGINE_MODELS=llama3.2:3b,deepseek-r1:latest`). For a cluster, see [Build a combined machine](/docs/cluster-thunderbolt).

The agent runs as a service — `launchd` on macOS, a `systemd --user` unit on Linux (run `loginctl enable-linger <user>` so it survives without a login session).

## Automated & bulk setup

For scripted provisioning (cloud-init, fleets of identical machines) you can skip the browser: mint an enrollment token in the portal (**Earn → Add node**, [`/earn/add`](/earn/add)) and bake it in.

```bash
porten enroll <token>
porten service install
```

## What "provisionable" means

A built-in node is **provisionable**: the Hub may fetch and run any enabled catalog model that fits its VRAM budget, on demand. It packs as many *demanded* models as fit, unloads idle ones, and downloads new weights when something is requested that isn't on disk yet. You set the VRAM and disk budgets; the Hub handles placement.

Ollama / OpenAI-engine nodes serve a fixed set you've installed — they aren't auto-provisioned, and their models aren't idle-evicted by the Hub.

## Getting paid

Connect a payout account in the portal. Serving is metered per token; payouts run on a schedule against your served volume. The portal's **Earn** section shows your nodes, what they're serving, and your earnings.

## What to build

See the [Hardware guide](/docs/hardware) for which models fit which hardware, and the [Thunderbolt cluster guide](/docs/cluster-thunderbolt) for pooling multiple Macs into one big node.
