Canonical page: [Providers and Model Roles](https://cloudflavor.io/aemon/docs/providers/)
Source snapshot: https://github.com/cloudflavor/aemon/blob/a85ee1d024b81c6373acd86379fe12f15c26a7a5/docs/providers.md

# Providers and Model Roles

Models are optional. Ingestion, crawling, `search` without `--rerank`/`--auto`, `get`,
`outline`, `ls`, `stats` and `audit` never call one.

## Provider specs

`--provider` and `--rerank` accept either a role-backed model or an explicit spec:

| spec | meaning |
|---|---|
| `auto` | try `ollama`, then `llama`, then `strata` (the default order) |
| `ollama[:model]` | Ollama; key from `OLLAMA_API_KEY`, default model `deepseek-v4.1-flash` |
| `llama[:model]` | any llama.cpp server at `LLAMA_BASE_URL` |
| `strata[:model]` | a local Strata server at `127.0.0.1:8082`, key `PI_DELEGATE_STRATA_API_KEY` |
| `openai:<base-url>[:model]` | any OpenAI-compatible endpoint |

Keys come from the environment and are never logged, never written into JSON reports and
never appear in error messages. A reasoning model that spends its whole budget on
`reasoning` is retried once with a 4× budget before giving up.

## `~/.config/aemon/model.toml`

A file and not only environment variables, because `ssh builder-host aemon search --auto`
runs a non-interactive shell that never sources `.zshrc`: `OLLAMA_API_KEY` would be
absent there and the decider would silently fall back to the heuristic plan. Environment
variables still take precedence when set.

A complete file lives at `deploy/model.toml.example` in the repository.

```toml
default = "remote"                 # used when a role names no model

[models.remote]
provider = "ollama"
model = "deepseek-v4.1-flash"
base_url = "https://ollama.com"
api_key_file = "~/.config/aemon/ollama.key"

[models.local]
provider = "strata"                # point base_url at your own inference server
model = "qwen3.8-flash-next-iq3_s"
base_url = "http://inference.internal:8082"

[roles]
decider = "remote"                 # routing: which library, expand, rerank?
rerank  = "remote"                 # listwise ordering of candidates
enrich  = "local"                  # per-chunk summaries; must be local
judge   = "remote"                 # eval harness: does this context answer the question?
```

Omit a role to inherit `default`. `enrich` is the one role with a hard rule: it runs per
chunk, so it refuses a metered endpoint unless `--allow-cloud` is passed.

`aemon models` lists what is configured and which roles use it — key presence only,
never credentials. `aemon models --json` returns the same under `result.models`.

## Remote corpus

The database lives on one machine, the CLI runs anywhere:

```sh
export AEMON_REMOTE=ssh://docs-host          # ssh docs-host aemon <args>  (recommended)
export AEMON_REMOTE=https://docs.example     # authenticated HTTPS proxy to `serve`
```

SSH is the default recommendation: authentication is already solved by your keys,
nothing listens on a port, and a query costs one exec (~50–150 ms on a LAN). A
non-interactive SSH shell has a minimal `PATH`, so the client tries `aemon`,
`~/.local/bin/aemon` and `/usr/local/bin/aemon`; set `AEMON_REMOTE_BIN` to the full path
if none of them is right. Multi-word queries are shell-quoted on the way out, so they
arrive as one argument.

HTTP transport, bearer tokens and the `/rpc` endpoint are covered in
[JSON API](json-api.md#http-transport).
