Documentation
¶
Overview ¶
Package zai provides Z.ai API integration for the LLM gateway.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registration = providers.Registration{ Type: "zai", New: New, Discovery: providers.DiscoveryConfig{ DefaultBaseURL: defaultBaseURL, }, }
Registration provides factory registration for the Z.ai provider.
Functions ¶
func New ¶
func New(cfg providers.ProviderConfig, opts providers.ProviderOptions) core.Provider
New creates a new Z.ai provider.
Types ¶
type Provider ¶
type Provider struct {
*openai.ChatCompatible
// contains filtered or unexported fields
}
Provider implements the core.Provider interface for Z.ai. keys is retained to inject auth on the GLM-Realtime websocket target.
func NewWithHTTPClient ¶
func NewWithHTTPClient(apiKey string, baseURL string, httpClient *http.Client, hooks llmclient.Hooks) *Provider
NewWithHTTPClient creates a new Z.ai provider with a custom HTTP client. If httpClient is nil, http.DefaultClient is used.
func (*Provider) RealtimeTarget ¶
func (p *Provider) RealtimeTarget(ctx context.Context, req *core.RealtimeRequest) (*core.RealtimeTarget, error)
RealtimeTarget implements core.RealtimeProvider for Z.ai / Zhipu GLM-Realtime, whose core event schema mirrors OpenAI's Realtime API. The host (region) comes from the configured base URL while the path is pinned to realtimePath so chat base variants like the Coding Plan endpoint still resolve correctly. Bearer auth is injected here and must never be logged.