Documentation
¶
Overview ¶
Package catalog provides embedded metadata for built-in model providers, without linking their SDK implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Providers = func() map[string]Provider { providers := make(map[string]Provider, len(orderedProviders)) for _, p := range orderedProviders { providers[p.Name] = p } return providers }()
Providers indexes built-in providers by name. Callers must not modify it.
Functions ¶
func AllProviders ¶
func AllProviders() []string
AllProviders returns all built-in provider names, sorted.
func DefaultModels ¶
DefaultModels returns the configured default models, keyed by provider name.
func IsCatalogProvider ¶
IsCatalogProvider reports whether a provider is usable without explicit endpoint configuration.
func IsDefaultEndpoint ¶
IsDefaultEndpoint treats an omitted endpoint and the catalog endpoint equally.
func IsKnownProvider ¶
IsKnownProvider reports whether the name identifies a built-in provider.
Types ¶
type Provider ¶
type Provider struct {
// Name is the canonical provider ID used in model references and catalog lookups.
Name string `json:"name"`
// APIType selects the registered API implementation that serves this provider.
APIType string `json:"api_type"`
// BaseURL is the default endpoint; API implementations resolve dynamic endpoints themselves.
// Environment references such as ${CLOUDFLARE_ACCOUNT_ID} expand at construction time.
BaseURL string `json:"base_url,omitempty"`
// TokenEnvVars lists token sources in priority order; explicit token_key overrides the list.
TokenEnvVars []string `json:"token_env_vars,omitempty"`
// DefaultModel is used when selecting this provider without an explicit model.
// Providers without one are excluded from automatic selection.
DefaultModel string `json:"default_model,omitempty"`
// RequiresConfiguration excludes providers needing a user-supplied endpoint from catalog listings and automatic selection.
RequiresConfiguration bool `json:"requires_configuration,omitempty"`
// MergeConsecutiveMessages coalesces adjacent same-role Chat Completions messages
// for servers whose chat templates reject multiple system messages.
MergeConsecutiveMessages bool `json:"merge_consecutive_messages,omitempty"`
// AutoResponses selects the Responses API for supported models unless api_type is explicit.
AutoResponses bool `json:"auto_responses,omitempty"`
// OpenAIVendor identifies genuine OpenAI model hosts, gating OpenAI-only wire fields.
// Speaking the OpenAI-compatible protocol alone does not qualify.
OpenAIVendor bool `json:"openai_vendor,omitempty"`
// Headers supplies default HTTP headers; user http_headers override them case-insensitively.
Headers map[string]string `json:"headers,omitempty"`
// QueryParams maps string-valued provider_opts keys to URL query parameter names.
QueryParams map[string]string `json:"query_params,omitempty"`
// Hint describes credential setup in automatic-selection errors; defaults to the token variable names.
Hint string `json:"hint,omitempty"`
}
Provider describes a provider's API and transport defaults. Callers must treat maps and slices returned by this package as read-only.
func CredentialProviders ¶
func CredentialProviders() []Provider
CredentialProviders returns providers with a default model and credential detection, in catalog order. Local providers are handled by discovery.