Skip to main content
egisai.Client is the shortest path to governed traffic when your organization uses the inline Gateway: one import, no provider SDK in your code, no base_url or header wiring.
Every call goes to the Gateway, which evaluates your policies, sanitizes or blocks inline, forwards the (possibly sanitized) payload to the provider the model name selects — OpenAI, Anthropic, Google, Mistral, xAI, or DeepSeek — and writes the audit row server-side. The call surface is the familiar chat-completions API, streaming included: client.chat.completions.create(..., stream=True) behaves as described in Gateway streaming. egisai.AsyncClient is the async sibling with identical parameters.
The client requires the openai package — it is the Gateway’s wire format, used as an internal transport. Install with pip install "egisai[openai]". A missing dependency raises an ImportError with the same hint.

Parameters

str | None
default:"None"
Your Egis key (egis_live_…). Falls back to the key from a prior egisai.init() call, then the EGISAI_API_KEY environment variable. Raises RuntimeError when no source provides one.
str | None
default:"None"
The upstream provider’s key (sk-…, sk-ant-…, AIza…, …). Carried in the Authorization header and forwarded to the provider verbatim — the platform never stores or logs it.Optional. Omit it to use BYOK vault mode: store your provider keys once on the dashboard’s Model Center page (encrypted at rest) and the Gateway supplies the right key for each request’s provider — no provider key in your code. When omitted and no key is stored, the transport falls back to OPENAI_API_KEY if set (legacy default-provider passthrough).
str | None
default:"None"
Explicit agent name for every call from this client (the X-Egis-Agent header). Without it, the Gateway derives identity from the system prompt automatically. Per-call context via egisai.set_context(agent=…) / with egisai.agent(…): wins over this default when egisai.init() is active.
str | None
default:"None"
Platform URL override for self-hosted / regional installs. Resolution mirrors init(): explicit value → a prior init()’s base_url → EGISAI_BASE_URL → the hosted control plane. /v1 is appended for you.
Any
Passed through to the underlying transport — timeout, max_retries, http_client, and friends.

Do I still need init()?

No — the Client carries its own keys and works standalone. Call init() too when you want the rest of the SDK: per-call context (set_context → X-Egis-Agent plus the X-Egis-User / X-Egis-User-Role / X-Egis-Session / X-Egis-Workflow / X-Egis-End-User context headers), in-process governance for everything the Gateway doesn’t carry (other provider SDKs, agent frameworks, MCP), and identity auto-detection. When both are active, calls made through egisai.Client are recognised as Gateway-bound and are never evaluated by the local engine — each call is governed and audited exactly once, server-side.

Client vs. init(gateway=True)

Both land on the same Gateway with the same policies and audit trail.

What’s next

Gateway overview

How inline governance works end to end.

set_context

Attach per-call metadata — works in Gateway mode too.