> ## Documentation Index
> Fetch the complete documentation index at: https://docs.egisai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Egis Connector

> Govern a model that lives inside your private network — no inbound firewall rule. A small outbound relay dials the Gateway, which rides that connection to reach your model.

Some models can't be dialed from the outside: a vLLM server inside a
VPC, an Ollama box behind a corporate firewall, a model on a developer's
laptop. Opening an inbound hole to the Egis cloud is exactly the kind of
change a security team won't sign off on.

The **Egis Connector** solves this the other way around. You run a small
daemon next to the model. It makes **one outbound** authenticated
WebSocket to the Gateway and holds it open. When a governed call targets
your private model, the Gateway relays the request down that existing
connection; the connector forwards it to the model on `localhost` (or
your internal network) and streams the reply back. Nothing ever connects
*in* to your network.

This is "Case 2" of the [custom-model](https://docs.egisai.co/integrations/custom-models.md)
transport options — a custom provider whose connection type is
**Via Egis Connector**.

## How a call flows

**1. The connector dials out**

On start it opens one WebSocket to the Gateway, authenticates with
its `egis_conn_…` token, enrolls (a stable node key), and heartbeats
every \~30s. If the connection drops it reconnects with backoff.

**2. A governed call arrives**

Someone calls `custom-<slug>/<model>` through the Gateway or SDK. The
request is governed by your policies first — PII masking, blocks,
everything — exactly as for any provider.

**3. The Gateway relays it down the open socket**

The (possibly sanitized) request rides the connector's existing
outbound connection. The connector forwards it to the model's base
URL and streams `resp` / `chunk` / `end` frames back.

**4. Response governance + audit**

Response-phase policies run on the completion and the call lands on
the Requests page like any other — no indication to the caller that
the model was reached through a relay.

## Run it

**1. Register the model**

Add a custom model with connection **Via Egis Connector**
([Custom models](https://docs.egisai.co/integrations/custom-models.md)). Its base URL is where
the *connector* reaches the model (e.g. `http://localhost:11434/v1`).

**2. Mint a connector token**

On **Model Center → LLM providers → Egis Connector**, click
**New token**. The `egis_conn_…` token is shown **once** — copy it.

**3. Start the connector next to your model**

```bash theme={null}
docker run -d --name egis-connector \
  -e EGIS_CONNECTOR_TOKEN=egis_conn_… \
  -v egis-connector:/var/lib/egis-connector \
  egisai/connector:latest
```

Within a few seconds it appears as **Online** on the connector card.

### Configuration

The connector is configured entirely by environment variables.

| Variable | Required | Default | Purpose |
| - | - | - | - |
| `EGIS_CONNECTOR_TOKEN` | **yes** | — | The `egis_conn_…` token minted on the connector card. |
| `EGIS_GATEWAY_URL` | no | `https://api.egisai.com` | The Gateway to dial. Point it at your control plane for a self-hosted deployment. |
| `EGIS_CONNECTOR_NAME` | no | the host name | A label shown on the fleet card. |
| `EGIS_STATE_DIR` | no | `/var/lib/egis-connector` | Where the stable node key is persisted — keep it on a volume so restarts keep the same identity. |
| `EGIS_CONNECTOR_NODE_KEY` | no | generated + persisted | Override the node identity explicitly (rarely needed). |

> [!NOTE]
>
> The model's URL is **not** configured on the connector — it comes from
> the custom model you registered, and the Gateway sends it with each
> relayed request. One connector can serve every private model in your
> organization.

## Security model

* **Outbound only.** The connector opens the connection; the Gateway
  never initiates one. No inbound firewall rule, no exposed port.
* **Scoped token.** The `egis_conn_…` token can do exactly one thing —
  enroll a connector and relay for its organization. It is not an Egis
  API key and can't read or change anything on the platform. Revoke it
  on the connector card and the daemon is disconnected on its next
  reconnect.
* **Fail closed.** If no healthy connector is registered, calls to the
  private model return `egis_connector_offline` (503) — never a silent
  fallback to a public provider.
* **Governance is unchanged.** The request is governed *before* it's
  relayed, so PII masking and blocks apply exactly as they do for a
  direct provider. The connector only moves bytes.
* **Non-root, minimal image.** The container runs as an unprivileged
  user and needs only outbound HTTPS to the Gateway and a route to your
  model.

## Fleet status

The connector card shows, at a glance, how many connectors are
**online** right now, how many have ever enrolled, and how many requests
the fleet has relayed. Each node shows its last heartbeat and relayed
count; revoke a token or remove a stale node from the same card.

> [!NOTE]
>
> The Egis Connector is a hosted-Gateway feature and requires the inline
> Gateway add-on. On a [self-hosted](https://docs.egisai.co/operations/self-hosting.md) control
> plane it isn't needed: the platform reaches your local models directly.

## What's next

> [card] [Custom models](https://docs.egisai.co/integrations/custom-models.md)
>
> Register the private model the connector reaches.

> [card] [Gateway overview](https://docs.egisai.co/gateway/overview.md)
>
> How inline governance works end to end.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.