modelconfig

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package modelconfig constructs the OpenAI-compatible client shared by repository-owned hosts. Callers own flag and environment handling, logging, and any built-in model fallback.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (*openai.Client, error)

New builds a client whose Model and StreamModel methods satisfy the controller's model seams. A model is required; this package neither reads the environment nor selects a fallback model.

With an APIKey set, New refuses a plain-http BaseURL unless its host is a loopback address, localhost, or a Kubernetes service name, the last as a trusted-network exception (see checkKeyedHTTP): the key and every prompt would otherwise cross the network unencrypted.

Types

type Config

type Config struct {
	Model   string
	BaseURL string
	Path    string
	// AuthHeader selects bearer authentication for Authorization (case-insensitive), or a raw
	// credential for any other header name. Empty AuthHeader or APIKey sends no credential.
	AuthHeader string
	APIKey     string
}

Config supplies explicit host-side model settings. Empty BaseURL and Path use openai's defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL