Skip to main content
The SDK governs self-hosted models the same way it governs OpenAI or Anthropic: one egisai.init() call, no per-call wiring. There are three ways your self-hosted traffic gets covered, depending on how your code reaches the model.

1. Point an OpenAI-compatible client at your server

If you run a model behind an OpenAI-compatible server (vLLM, Ollama, TGI, SGLang, …), just point the openai client’s base_url at it. egisai.init() patches the client, so every call is governed in-process before it leaves your process — regardless of the base URL:
Policies, PII masking, and the audit trail all apply. Streaming and tool calling are unchanged — the SDK governs the request before the stream starts and the response as it completes.

2. Route through the Gateway to a registered custom model

If you’ve registered the model as a custom provider, address it as custom-<slug>/<model> and let the Gateway handle the provider key (from the encrypted vault) and the transport — including reaching a private model through the Egis Connector:
Existing code that already uses the OpenAI client can route through the Gateway without touching call sites:
See init() → gateway.
Use option 1 when the model is reachable from your own process and you want sub-millisecond in-process governance; use option 2 when you want the key in the vault, Smart Routing, or a private model reached through the connector.

3. Raw HTTP calls to a registered custom host — covered automatically

Code that calls a self-hosted model over plain httpx or requests (no OpenAI client) is still seen. When you register a custom model, its host is published to the SDK, and a raw call to that host on an inference-shaped path is attributed and audited automatically:
This path is audit-only and fail-open: it records the call so your self-hosted traffic shows up alongside everything else, and it never breaks the request if the SDK can’t reach the control plane. Turn on Govern this host when registering the model to also cover direct browser and network traffic to it through the egress node and browser extension.

What’s next

Custom models

Register a self-hosted model on the Gateway.

Egis Connector

Reach a model with no inbound access.

HTTP clients

How the SDK covers raw httpx / requests calls.

Self-hosting

Run the whole control plane in your network.