# Install the AI Gateway on an Edge

URL: https://www.elchi.io/docs/ai-gateway/installation

> Run elchi-ai-gateway on an edge: built into Elchi OS 0.8.0+, or installed on a plain Linux edge with its own installer, including offline installs, the engine version gate, config.yaml, sinks, upgrades and removal.

The AI gateway runs on each edge (client) VM as one systemd service, `elchi-ai-gateway`, next to the agent (`elchi-client`) and Envoy. Every AI listener on that VM uses it. This page covers getting it there and the settings only the operator owns. Everything the gateway serves (providers, gateways, consumers, MCP servers) comes from the control plane; see [Operations](https://www.elchi.io/docs/ai-gateway/operations).

## Requirements

| Requirement | Detail |
|---|---|
| Architecture | Linux amd64. The installer refuses any other architecture; only `linux-amd64` binaries are published. |
| Agent | `elchi-client` on the same host, registered to the project. The agent delivers the configuration and reports the installed gateway's version when it registers. |
| Envoy | Envoy's user (default `envoyuser`) in the `elchi` group, to reach the gateway's sockets. The Envoy versions are those your control plane serves; the AI gateway is proven end to end on Envoy 1.39.4 and 1.40.2. |
| Control plane | `ELCHI_JWT_SECRET` set on the controller (the AI gateway API answers `503` without it). |
| Tools (plain Linux) | `curl`, `python3` (the installer parses the archive index and writes `config.yaml` with it), `nftables` (`nft`) for the port guard. |
| ClickHouse (optional) | For usage, cost, the request log, provider status and quotas shared across edges. |

## On Elchi OS

Elchi OS 0.8.0 and later ship the AI gateway in the image (0.8.0: `elchi-ai-gateway` v0.4.3 with extproc engine v1.3.0) and run it by default. It has nothing to serve until a project configures an AI gateway. Going back to 0.7.x with a rollback leaves the appliance without the AI gateway: AI listeners deployed there answer nothing until it is upgraded again.

The engine ships in the image too. At each start the gateway's preparation step lays the image's engine into the gateway's store when the store lacks it (or holds a copy that fails its recorded checksum), so it starts without the network.

### Console commands

| Command | What it does |
|---|---|
| `show ai-gateway` | Readiness and state, the unit's restarts, the configuration version it serves (or "none pushed by the control plane yet"), the gateway build and extproc version, each gateway with its hosts and model count, the providers, render and reload failures since start with the last error, the sinks, and the recent configuration events from the journal. |
| `show health` | Has an AI gateway line: information (not a fault) while no configuration was pushed; critical when it does not answer, its extproc keeps exiting, or it waits for its engine; warning when it serves the last accepted configuration because a newer one was refused. |
| `logs ai-gateway [n] [follow] [grep <pattern>]` | The service's journal; `n` 1–5000 (default 100). |
| `restart ai-gateway` | Asks first: "Restarting the AI gateway interrupts every AI listener for a few seconds. Continue?" |
| `set ai-gateway usage clickhouse <host:port> <database> <user> [tls]` | Usage, the request log and the gateway's other tables go to that ClickHouse. The password is asked at a hidden prompt (Enter for none), never typed on the line; a `clickhouse://` URL on the line is refused. `tls` adds `secure=true`. |
| `set ai-gateway usage none` | No export: the gateway serves traffic, the control plane shows no usage or request log for this appliance, and a consumer's quotas count only this appliance's requests since it started. |
| `set ai-gateway usage ttl <days>` | The usage table's retention, 32–3650 days (default 90). It applies when the gateway creates the table; an existing table keeps its own. |
| `set ai-gateway metrics otlp <https://host:port> [insecure]` | Push the engine's GenAI metrics over OTLP/gRPC. `http://` or `insecure` sends without TLS. Only scheme, host and port are accepted. |
| `set ai-gateway metrics none` | Stop the push. |
| `apply` | Writes the staged settings into `/etc/elchi/elchi-ai-gateway/config.yaml` in place (comments, the agent's `project:` line and other keys stay), restarts the gateway and waits up to 30 s for it to answer. If it does not, the previous file is put back and the gateway restarted on it. It then warns about a sink this appliance cannot reach. |
| `system component status` / `list [elchi-ai-gateway]` | What is installed, pinned, and which versions the signed index offers. |
| `system component install elchi-ai-gateway v<version>` | Moves the gateway to that version; its engine comes from the index with it. |
| `system component update elchi-ai-gateway` / `update all` | The newest version the index offers; `all` goes agent → WAF → AI gateway and stops at the first failure (that one is put back). |
| `system component reset elchi-ai-gateway` | Puts a pinned gateway back on the version the running release ships. |
| `import component elchi-ai-gateway <path> v<version> [sha256]` | Installs a gateway binary brought by hand (file under `/home/admin` or `/tmp`). |
| `import extproc <path> v<version> [sha256]` | Places an extproc engine brought by hand in the gateway's store; nothing is restarted. Do this before importing a gateway that runs that engine. |

An installed or updated gateway is kept only when it answers and either serves a configuration or has none pushed yet. After the gateway's binary changes the agent is restarted so it registers again; the control plane picks the configuration set it sends by the reported version. Details: [Elchi OS upgrades](https://www.elchi.io/docs/elchi-os/upgrades) and the [console reference](https://www.elchi.io/docs/elchi-os/console).

The same sinks can be set unattended: the `ai_gateway:` block of `setup.yaml`

```yaml
ai_gateway:
  usage:
    exporter: clickhouse          # clickhouse | none
    clickhouse_dsn: clickhouse://elchi:<password>@10.0.0.5:9000/elchi
    clickhouse_ttl_days: 90       # 32-3650
  metrics:
    otlp_endpoint: https://10.0.0.6:4317
    otlp_insecure: false
```

or the OVA properties `elchi.aigw.clickhouse_dsn`, `elchi.aigw.metrics_otlp_endpoint` and `elchi.aigw.metrics_otlp_insecure`. `config export` carries these settings, never the provider credentials the control plane pushes.

### Egress proxy and isolation

- **Proxy.** With `set proxy` configured, the gateway's calls to the internet (an Azure Entra ID token, the engine's download) go through it. Loopback, the Azure instance metadata service (`169.254.169.254`) and the ClickHouse and OTLP hosts named in `config.yaml` stay direct. `set proxy` offers to restart the gateway; it reads the proxy at each start.
- **Port guard.** The engine's admin port 9064 listens on every address and cannot be told otherwise. The gateway's own nftables table closes it to everything but loopback, whatever the host firewall says; the gateway does not start without it. The MCP egress `127.0.0.1:10088` accepts connections only from the gateway's own processes (matched by its service cgroup while it runs) and only Envoy's user may answer from that port.
- **Isolation from the WAF.** The WAF and the gateway both run as the agent's user. The gateway's unit cannot read the agent's token and identity, `setup.yaml`, the egress credential or the WAF's files, and runs in a PID namespace of its own.

## On a plain Linux edge

### Install with the agent

The `elchi-client` installer installs the AI gateway by default. It resolves the newest `elchi_ai_gateway_releases` entry in the archive index, downloads that release's `elchi-ai-gateway-install.sh`, checks its sha256 and runs it. Pass `--no-ai-gateway` to skip it. The project id comes from the registration token. `ELCHI_ARCHIVE_INDEX_URL` points it at a mirror. The installer also keeps `elchi-ai-gateway-uninstall.sh` in `/etc/elchi/bin`. See [Client installation](https://www.elchi.io/docs/installation/client/installation).

After the install, check `usage.clickhouse_dsn` in `/etc/elchi/elchi-ai-gateway/config.yaml`; if it is empty, set it (below) and restart the gateway, or usage and the request log are not exported.

### Install on its own

Fetch the installer from the archive index and verify it:

```bash
VER=v0.4.3   # an elchi_ai_gateway_releases version
IDX=$(curl -fsSL https://archive.elchi.io/index.json)
F=$(echo "$IDX" | jq -c --arg v "$VER" '.elchi_ai_gateway_releases[] | select(.version==$v)
      | .files[] | select(.name=="elchi-ai-gateway-install.sh")')
curl -fsSL -o elchi-ai-gateway-install.sh "$(echo "$F" | jq -r .download_url)"
echo "$(echo "$F" | jq -r .sha256)  elchi-ai-gateway-install.sh" | sha256sum -c -

sudo bash elchi-ai-gateway-install.sh --version=$VER \
  --project=<project id> \
  --clickhouse-dsn-file=/root/aigw-dsn.txt
```

| Option | Effect |
|---|---|
| `--version=vX.Y.Z` | Install this release (default: the newest by semantic version in the index). |
| `--build` | Build from a source checkout instead of downloading. |
| `--envoy-user=NAME` | Envoy's user to add to the `elchi` group (default `envoyuser`). Missing user: a warning, and the sockets are unreachable until you add it yourself. |
| `--no-start` | Install and enable, do not start. |
| `--project=ID` | Project id stamped on usage and request rows (`config.yaml` `project:`). |
| `--clickhouse-dsn=DSN` | ClickHouse for usage and the request log. Visible in `ps` while the installer runs. |
| `--clickhouse-dsn-file=PATH` | Read the DSN from a file instead (preferred). |
| `--extproc-version=vX` | Engine version to pin. Default: the `extproc_version` of the release being installed, else v1.3.0. |
| `--index-url=URL` | Archive index of an air-gapped mirror; also written to `config.yaml`. |
| `--requests=on\|off` | Request log on or off (default on). |
| `--metrics-otlp-endpoint=URL`, `--metrics-otlp-ca-cert=PATH` | Push the engine's GenAI metrics over OTLP. |
| `--no-firewall` | Do not install the nftables rules. |
| `--print-firewall` | Print the rules this host would get, then exit. |

What the installer does, in order:

1. Requires root, checks the architecture (amd64 only).
2. Creates the system group and user `elchi` if missing and adds Envoy's user to the group.
3. Creates `/etc/elchi/elchi-ai-gateway` (root:elchi 0750), `conf.d/` (elchi 0750) and the engine store `/var/lib/elchi/ai-gateway` (elchi 0700). Any `conf.d` file not owned by `elchi` is chowned and set to 0600, so the service can read it.
4. Downloads the gateway binary from the index, verifies its sha256 and installs `/etc/elchi/bin/elchi-ai-gateway`.
5. Checks that the archive offers the engine version it pins; if not, it stops with "extproc vX is not in the archive index" instead of leaving a service that waits for its engine forever.
6. Writes `config.yaml` (first run only; see [Re-runs and upgrades](#re-runs-and-upgrades)) and sets it to `elchi:elchi 0600` on every run.
7. Writes the nftables table `inet elchi_ai_gateway` to `/etc/elchi/elchi-ai-gateway/firewall.nft`, loads it, and installs `elchi-ai-gateway-firewall.service`, which loads it at boot before the network comes up. The gateway's unit loads it again on every start.
8. Writes and enables `elchi-ai-gateway.service` and restarts it.

The rules it installs:

- **Port 9064** (the engine's admin port: metrics and health, no authentication, binds every address): dropped unless it arrives on `lo`.
- **Port 10088** (the AI listeners' loopback MCP egress): only the `elchi` user may connect to `127.0.0.1:10088`; only Envoy's user may answer from it, and any other SYN-ACK from that port is dropped (a syncookie SYN-ACK belongs to no socket, so a user match alone would miss it). Users go in as numeric ids. If Envoy's user does not exist yet, only the connect rule is installed; re-run the installer once it exists.

Without `nft` the installer warns and you must close port 9064 to non-loopback traffic yourself.

The unit it writes runs the gateway as `elchi:elchi` with a `RuntimeDirectory` `/run/elchi-ai-gateway` (setgid, mode 2750), validates `conf.d` before start (a failure does not stop the start), restarts on exit after 5 s, and stops with SIGTERM to the supervisor only (it drains the engine itself; `TimeoutStopSec=60`). It is hardened: no capabilities, `ProtectSystem=strict`, only the engine store writable, `conf.d` and `config.yaml` read-only to the service, and the agent's `config.yaml`, client id and Shield's directory inaccessible.

### Check that it runs

```bash
systemctl status elchi-ai-gateway
/etc/elchi/bin/elchi-ai-gateway --version
#   elchi-ai-gateway v0.4.3 (commit …, upstream ai-gateway pin v1.3.0)
curl -s http://127.0.0.1:9002/readyz      # "ready" once the engine runs a configuration
curl -s http://127.0.0.1:9002/configz | jq '{state, config_version, extproc}'
```

Before any configuration is pushed, `/readyz` answers `503 not ready` and `/configz` shows `config_version: "empty"` with state `degraded` (nothing to run). After the agent registers, the control plane sends the project's configuration to this edge. If you installed the gateway after the agent registered, restart the agent (`systemctl restart elchi-client`) so it registers again and reports the gateway; its reconnect also queues a deploy to this edge.

## Files, sockets and ports

| Path / port | What |
|---|---|
| `/etc/elchi/bin/elchi-ai-gateway` | The supervisor binary. |
| `/etc/elchi/elchi-ai-gateway/config.yaml` | Operator-owned process and sink settings, read once at start. |
| `/etc/elchi/elchi-ai-gateway/conf.d/` | The configuration the agent delivers (`00-providers.yaml`, `00-consumers.yaml`, `gw-<name>.yaml`, 0600). Hot-reloaded. Not edited by hand. |
| `/var/lib/elchi/ai-gateway/<version>/extproc` | The engine, with `extproc.sha256` and `extproc.version_string` next to it. The current and one previous version are kept. |
| `/var/lib/elchi/ai-gateway/last-good.json` | The last configuration the engine accepted (0600), restored when `conf.d` is unusable at start. |
| `/var/lib/elchi/ai-gateway/fileid.seed` | Per-VM seed for the engine's Files/Batch id encryption, created 0600 on first start. |
| `/run/elchi-ai-gateway/extproc.sock` | The engine's `ext_proc` socket; Envoy dials it. |
| `/run/elchi-ai-gateway/authz.sock` | The supervisor's authorization, MCP result scan and access-log socket. |
| `/run/elchi-ai-gateway/mcp.sock` | The engine's MCP proxy. |
| `/run/elchi-ai-gateway/bundle/` | The rendered engine config bundle (it carries credentials; tmpfs). |
| `127.0.0.1:9002` | Supervisor HTTP: `/healthz`, `/readyz`, `/configz`, `/metrics`. Loopback only. |
| `127.0.0.1:9003` | Request-log receiver (OTLP/gRPC from the engine). Loopback only. |
| `:9064` | Engine admin port; firewalled to loopback. |
| `127.0.0.1:10088` | The AI listeners' MCP egress (Envoy's, not the gateway's). |

Full list: [Ports, files and tables](https://www.elchi.io/docs/ai-gateway/reference/ports-files-and-tables).

## The extproc engine

### Download from archive.elchi.io

The gateway runs the engine version named by `extproc.version` in `config.yaml` (on Elchi OS: the version the gateway binary was built for). At start it looks in `/var/lib/elchi/ai-gateway/<version>/`:

- A cached binary is re-verified against the checksum recorded at download, and used without the network.
- Otherwise it reads `https://archive.elchi.io/index.json` (key `ai_gateway_extproc_releases`), downloads the `linux-amd64` binary, verifies its sha256 and records the checksum and the release's version string next to it.
- A forced or repair download replaces the cached binary only once the new one verified. With the archive unreachable, a cached binary that still verifies is kept.
- Older version directories are pruned: the current and the most recent other stay.

Until it has a binary the gateway's state is `ensuring-binary` and AI listeners on the edge answer nothing. If the engine's version line differs from the one the gateway renders for, it logs "extproc version differs from the filterapi pin this build renders for; reloads may be rejected".

### Offline: a pre-placed binary

On an edge without access to the archive, place the engine yourself and point the gateway at it. The pre-placed binary wins over any download.

```yaml
# /etc/elchi/elchi-ai-gateway/config.yaml
extproc:
  binary: /var/lib/elchi/ai-gateway/v1.3.0/extproc
  sha256: <hex>            # optional; a mismatch stops the start
  version_string: v1.3.0   # optional; see the version gate below
```

The same as flags: `--extproc-binary`, `--extproc-binary-sha256`, `--extproc-version-string`. A mirror works too: `extproc.index_url` (or `--index-url` at install) may be an `https://` or a `file://` URL. On Elchi OS use `import extproc` instead.

### The version gate

The engine refuses any configuration whose `version` field is not its own version string. It logs the refusal; it does not crash. The gateway stamps the string in this order: `extproc.version_string` (flag `--extproc-version-string`), the index's `version_string` for that release, the `extproc.version_string` file next to the binary, else `dev`. If the engine still reports `config version mismatch: expected "…"`, the gateway adopts the expected string, renders again and restarts the engine, once per binary and string. If that fails too it logs "giving up on self-heal" and the configuration is not applied. Set `version_string` only when you know the binary reports something other than its release label.

The engine always runs with `-enableRedaction`, without its pprof server, and with an allowlisted environment.

## config.yaml

`/etc/elchi/elchi-ai-gateway/config.yaml` is the operator's file: sink credentials, telemetry and the engine pin. It is read once at start; change it and restart the gateway. The hot-reloaded gateway configuration never lives here.

- **Precedence** per setting: command-line flag > `ELCHI_AI_GATEWAY_*` environment variable > this file > built-in default. An explicitly empty flag (for example `--usage-clickhouse-dsn=`) beats the file.
- **Strict.** An unknown key or a malformed value stops the start with `fatal: config file …`. An empty file means all defaults.
- **Mode.** The installer keeps it `elchi:elchi 0600`. The gateway warns at start when the file is group-writable or readable by others: it holds the ClickHouse password, and Envoy's user is in the `elchi` group.

| Key | Default | Flag | Meaning |
|---|---|---|---|
| `project` | empty | `--usage-project` | Project id stamped on every usage, request, decision and MCP call row. The control plane reads rows by project; the agent keeps it current when the edge moves to another project. |
| `usage.clickhouse_dsn` | empty | `--usage-clickhouse-dsn` | ClickHouse for usage **and** the request log, decisions, provider answers and MCP calls. Empty disables all of them. An invalid DSN disables export with a warning; the gateway still serves. |
| `usage.clickhouse_table` | `elchi_ai_gateway_usage` | `--usage-clickhouse-table` | Usage table name. |
| `usage.clickhouse_ttl_days` | 90 | `--usage-clickhouse-ttl-days` | Usage retention; at least 32 (a shorter value is raised to 32: monthly quotas are summed from this table). Also the MCP call log's retention. Applies when the table is created. |
| `usage.scrape_interval` | `30s` | `--usage-scrape-interval` | How often the engine's token counters are read for usage. |
| `usage.gateway_header` | `x-elchi-ai-gateway` | `--usage-gateway-header` | The header Envoy sets to the gateway name; keyed gateways need it. Leave it. |
| `requests.enabled` | `true` | `--requests-enabled` | Request-log kill switch. Rows need a DSN and/or a forward endpoint; per-gateway levels come from the control plane. |
| `requests.table` | `elchi_ai_gateway_requests` | `--requests-table` | Request-log table name. |
| `requests.receiver_addr` | `127.0.0.1:9003` | `--requests-receiver-addr` | Where the engine sends its spans. Must be loopback (it receives unredacted content). |
| `requests.forward.endpoint` | empty | `--requests-forward-endpoint` | Also send the policy-filtered spans to an external OTLP/gRPC tool (`host:port`). |
| `requests.forward.insecure` | `false` | `--requests-forward-insecure` | Forward without TLS. |
| `requests.forward.headers` | none | `--requests-forward-headers` | Headers for the forward endpoint (map; flag form `k=v,k2=v2`). |
| `telemetry.metrics_otlp_endpoint` | empty | `--metrics-otlp-endpoint` | Push the engine's GenAI metrics over OTLP/gRPC (for example the stack's collector). Empty keeps them on the admin port only. |
| `telemetry.metrics_otlp_insecure` | `false` | `--metrics-otlp-insecure` | Push without TLS. |
| `telemetry.metrics_otlp_ca_cert` | empty | `--metrics-otlp-ca-cert` | CA certificate file for the metrics endpoint. |
| `telemetry.metrics_otlp_headers` | none | `--metrics-otlp-headers` | Headers for the metrics endpoint. |
| `extproc.version` | none (installer writes it) | `--extproc-version` | Engine release to download. Required unless `extproc.binary` is set. |
| `extproc.binary` | empty | `--extproc-binary` | Pre-placed engine; skips downloading. |
| `extproc.sha256` | empty | `--extproc-binary-sha256` | Expected checksum of the pre-placed engine. |
| `extproc.version_string` | empty | `--extproc-version-string` | Override the version-gate stamp. |
| `extproc.index_url` | `https://archive.elchi.io/index.json` | `--extproc-index-url` | Archive index (a mirror for air-gapped sites). |
| `extproc.admin_port` | 9064 | `--extproc-admin-port` | Engine admin port. The installer's firewall rule names 9064; change both or neither. |
| `extproc.log_level` | the gateway's log level | `--extproc-log-level` | `debug`, `info`, `warn` or `error`. Bodies are always redacted. |
| `extproc.endpoint_prefixes` | empty (engine default) | `--endpoint-prefixes` | Passed to the engine as `-endpointPrefixes`, e.g. `anthropic:/` serves the native Anthropic API at `/v1/messages` instead of `/anthropic/v1/messages`. |

The decisions, provider-answer and MCP call tables are named by flags only (`--decisions-table`, `--upstream-table`, `--mcp-calls-table`). The installed unit passes `--config-dir`, `--config-file`, `--extproc-addr`, `--http-addr`, `--log-format json` and `--log-level info`; Elchi OS sets the same through environment variables.

A complete example:

```yaml
project: "<project id>"
usage:
  clickhouse_dsn: "clickhouse://elchi:<password>@10.0.0.10:19000/elchi"
  clickhouse_table: elchi_ai_gateway_usage
  clickhouse_ttl_days: 90
requests:
  enabled: true
  table: elchi_ai_gateway_requests
  # forward:
  #   endpoint: langfuse.example.com:4317
  #   headers: {authorization: "Bearer ..."}
telemetry:
  metrics_otlp_endpoint: ""
extproc:
  version: v1.3.0
```

### ClickHouse

The edge writes to ClickHouse directly; the control plane reads the same database for the Usage, Request log and MCP calls tabs and for quotas. The tables are created on first connect.

- **Elchi standalone stack.** Every node's Envoy carries a plain TCP proxy on port **19000** to ClickHouse's native port, for edges. Use `clickhouse://elchi:<password>@<any node>:19000/elchi` (`elchi-stack show-secret clickhouse` prints the password). The proxy is not TLS; keep it on a trusted network.
- **Your own ClickHouse.** Any native-protocol DSN the controller's ClickHouse also serves.
- **ClickHouse unreachable.** Export is best-effort: the gateway keeps serving, buffers rows briefly and drops them when the buffer is full (`elchi_ai_gateway_*_rows_dropped_total` on `/metrics`). Quotas then count only what this edge saw since it started; the gateway logs this at start when no DSN is set.

### OTLP sinks

- `telemetry.metrics_otlp_*`: the engine's GenAI metrics (tokens, latency, time to first token) pushed to a collector, for example the stack's collector feeding VictoriaMetrics.
- `requests.forward.*`: the request-log spans after the gateway's capture policy and masking, forwarded to an external OTLP/gRPC tool. Content follows the gateway's request-log policy ([Request log](https://www.elchi.io/docs/ai-gateway/request-log)).

## Re-runs and upgrades

**Plain Linux.** Re-run the installer with the new `--version=`. It installs the new binary and restarts the service. It keeps your `config.yaml`, but applies what the run says: `--project` and `--clickhouse-dsn[-file]` when given, and always the engine pin of the release being installed (a gateway renders for one engine release only; an old pin would never start the engine). It prints what it changed. The new engine is downloaded at start; the previous one stays in the store. The agent reports the new version only when it registers again: restart `elchi-client` afterwards.

**Elchi OS.** `system component update elchi-ai-gateway` (or `update all`), or an OS upgrade that ships a newer gateway. The OS upgrade's trial boot waits for the AI gateway to answer again when it answered before, and to serve again when it served before.

**Edges older than MCP.** An edge whose gateway is older than v0.4.0 gets the configuration without MCP, and MCP is held back on every AI listener of the project until no client reports such a version. See [Operations](https://www.elchi.io/docs/ai-gateway/operations#edges-with-an-older-gateway).

## Removal

**Plain Linux:**

```bash
sudo /etc/elchi/bin/elchi-ai-gateway-uninstall.sh        # asks first; --yes to skip
```

The agent's installer puts the uninstaller there. If you ran `elchi-ai-gateway-install.sh` on its own, fetch `elchi-ai-gateway-uninstall.sh` from the same release in the archive index (it has its own sha256) and run it the same way.

It stops and disables `elchi-ai-gateway.service` and `elchi-ai-gateway-firewall.service`, deletes the `inet elchi_ai_gateway` nftables table, and removes the binary, `/etc/elchi/elchi-ai-gateway` (config and `conf.d`) and `/var/lib/elchi/ai-gateway` (engines, last-good, seed). The shared `elchi` user and group and `/etc/elchi` stay. Remove AI listeners from this edge first: without the gateway they answer nothing.

**From the project, not the edge:** to stop serving AI traffic project-wide, remove the AI listeners and then the configuration (**Remove** on the AI Gateway page); every edge then gets an empty configuration. See [Operations](https://www.elchi.io/docs/ai-gateway/operations#removing-the-whole-configuration).
