Documentation
¶
Overview ¶
Package modelrouting selects provider routes and model settings.
Index ¶
- Constants
- func IsLocalBaseURL(baseURL string) bool
- func IsOpenAICompatibleModel(model string) bool
- func IsReasoningModel(model string) bool
- func LooksLikeLocalOpenAICompatibleModel(model string) bool
- func ModelRejectsIsErrorField(model string) bool
- func ProviderForModel(model string) string
- func RedactURL(raw string) string
- func RequiresReasoningContentHistory(model string) bool
- func ResolveAlias(model string) string
- func UsesMaxCompletionTokens(model string) bool
- func WireModelForBaseURL(model string, baseURL string) string
- type BaseURLDiagnostic
- type ModelAlias
- type TokenLimit
Constants ¶
View Source
const ( ProviderAnthropic = "anthropic" ProviderOpenAI = "openai" ProviderXAI = "xai" ProviderDashScope = "dashscope" DefaultAnthropicBaseURL = "https://api.anthropic.com" DefaultOpenAIBaseURL = "https://api.openai.com/v1" DefaultXAIBaseURL = "https://api.x.ai/v1" DefaultDashScopeBaseURL = "https://dashscope.aliyuncs.com/compatible-mode/v1" )
Variables ¶
This section is empty.
Functions ¶
func IsLocalBaseURL ¶
IsLocalBaseURL reports whether baseURL points at loopback or private-network host.
func IsOpenAICompatibleModel ¶
func IsReasoningModel ¶
func ProviderForModel ¶
func ResolveAlias ¶
func UsesMaxCompletionTokens ¶
func WireModelForBaseURL ¶
Types ¶
type BaseURLDiagnostic ¶
type BaseURLDiagnostic struct {
Provider string `json:"provider,omitempty"`
Env string `json:"base_url_env,omitempty"`
Source string `json:"base_url_source,omitempty"`
URL string `json:"base_url,omitempty"`
Valid bool `json:"base_url_valid"`
Scheme string `json:"base_url_scheme,omitempty"`
Host string `json:"base_url_host,omitempty"`
Local bool `json:"local_base_url,omitempty"`
ErrorKind string `json:"base_url_error_kind,omitempty"`
Error string `json:"base_url_error,omitempty"`
}
BaseURLDiagnostic is a redaction-safe provider endpoint validation result.
func DiagnoseBaseURL ¶
func DiagnoseBaseURL(provider string, envName string, source string, raw string) BaseURLDiagnostic
DiagnoseBaseURL validates a provider base URL without exposing credentials.
type ModelAlias ¶
func BuiltInAliases ¶
func BuiltInAliases() []ModelAlias
type TokenLimit ¶
func TokenLimitForModel ¶
func TokenLimitForModel(model string) (TokenLimit, bool)
Click to show internal directories.
Click to hide internal directories.