Omni.Providers.Zai (Omni v1.4.0)

Copy Markdown View Source

Provider for the Z.ai API, using the Omni.Dialects.OpenAICompletions dialect.

Not loaded by default — must be explicitly enabled. Either add it to your provider list in application config:

config :omni, :providers, [:anthropic, :openai, :google, :zai]

Or load it at runtime:

Omni.Provider.load([:zai])

Reads the API key from the ZAI_API_KEY environment variable — no further configuration is needed if the variable is set.

Configuration

Override the default API key or base URL via application config:

config :omni, Omni.Providers.Zai,
  api_key: {:system, "MY_ZAI_KEY"}

Any key from the provider's config/0 can be overridden: :api_key, :base_url. See Omni.Provider for details.

Reasoning

The :thinking option is supported. Z.ai exposes no effort granularity — all positive levels (:low through :max) enable reasoning equally.

Structured output

The :output option is supported. Z.ai doesn't natively support JSON Schema constraints, so structured output is achieved via a system prompt fallback.