> ## 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.

# Custom models

> Register your own self-hosted or open-source models — any OpenAI-compatible endpoint — so the Gateway, Smart Routing, and the SDK govern them exactly like a public provider.

The Gateway is not limited to public vendors. Register a model you run
yourself — vLLM, Ollama, TGI, SGLang, or anything that speaks the
OpenAI wire format — and Egis governs and routes to it with the same
policies, audit trail, and cost accounting as OpenAI or Anthropic.

Each registered endpoint is a **custom provider**, addressed everywhere
on the platform as:

```
custom-<slug>/<model>
```

So a provider with slug `verda` serving `llama-3-70b` is called as
`custom-verda/llama-3-70b` — in the Playground, in Smart Routing, in
cost reports, and from your own client code.

## Register one

Open **Model Center → LLM providers → Custom models** (workspace owner
or admin) and add a model. The fields:

| Field | What it's for |
| - | - |
| **Display name** / **Slug** | The human label and the `custom-<slug>` id. The slug is permanent. |
| **Base URL** | The OpenAI-compatible base — the part before `/chat/completions` (e.g. `https://models.internal.acme.com/v1`). |
| **How Egis reaches it** | `Direct` (Egis dials the URL) or `Via Egis Connector` (a private endpoint reached through the relay). See below. |
| **Authentication** | `None`, `Bearer token`, or a `Custom header` you name. Any key is stored encrypted at rest — only the last four characters come back. |
| **Model names** | The model ids this endpoint serves. Each becomes `custom-<slug>/<name>`. |
| **Context window / prices** | Optional. Leave prices blank for a self-hosted model — cost reports show "Self-hosted" and Smart Routing treats it as the cheapest option. |
| **Smart Routing tier** / **Eligible for Smart Routing** | The capability tier (1 light … 5 frontier) and whether routing may auto-select it. Explicit `custom-<slug>/<model>` calls always work regardless. |
| **Govern this host** | Also register the endpoint's host as a governed AI tool, so the [egress node](https://docs.egisai.co/coverage/egress-node.md) and [browser extension](https://docs.egisai.co/coverage/browser-extension.md) cover direct calls to it too. |

**Test connection** probes the endpoint before you save, so a typo or a
wrong key fails in the dialog, not on your first real call.

## Two ways Egis reaches your model

**1. Direct — the cloud dials your URL**

For a model on the public internet, or any endpoint the Egis cloud
can reach, the Gateway connects to the base URL itself. The URL is
validated against SSRF (private, loopback, and cloud-metadata
addresses are refused for direct connections, and redirects are not
followed to a blocked host).

**2. Via Egis Connector — for a private network**

For a model with **no inbound** — inside a VPC, behind a firewall,
on a laptop — pick **Via Egis Connector**. You run a small outbound
relay next to the model; it dials out to the Gateway, and the
Gateway rides that connection to reach the model. The cloud never
needs a route into your network. See
[Egis Connector](https://docs.egisai.co/integrations/egis-connector.md).

> [!WARNING]
>
> A connector-mode model is **fail-closed**: if no healthy connector is
> currently registered for your organization, calls return
> `egis_connector_offline` (503). Egis never silently falls back to a
> public provider for a model you marked private.

## Keys stay in the vault

A custom model's key is handled exactly like a BYOK provider key:
encrypted at rest (Fernet / AES-128), decrypted only in memory on the
forward path, never logged, never returned by the API. The dashboard
shows only the last four characters. Managing custom models is
restricted to workspace owners and admins and requires the inline
Gateway add-on.

## Call it

Once registered, `custom-<slug>/<model>` works anywhere a model name
does — through the first-party client, raw HTTP, or the SDK:

```python theme={null}
import egisai

client = egisai.Client(api_key="egis_live_…")  # key comes from the vault
client.chat.completions.create(
    model="custom-verda/llama-3-70b",
    messages=[{"role": "user", "content": "Summarize this ticket…"}],
)
```

Streaming and tool calling work unchanged — the Gateway governs the
custom model with the same two-phase policy engine it runs for every
provider, and the request appears on the Requests page with its
`custom-<slug>/<model>` id.

## What's next

> [card] [Egis Connector](https://docs.egisai.co/integrations/egis-connector.md)
>
> Reach a private model with no inbound access.

> [card] [SDK with self-hosted models](https://docs.egisai.co/integrations/self-hosted-models.md)
>
> Govern direct calls to your own model from Python.

> [card] [Smart model routing](https://docs.egisai.co/concepts/smart-model-routing.md)
>
> Let routing pick a custom model as a target.

> [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.