Documentation
¶
Index ¶
- func AllProvidersInfo() map[internaltypes.APIProvider]ProviderInfo
- func DefaultBaseURL(providerName string) string
- func NeedsCatalogReseed(providerName string, knownModelIDs []string) bool
- func ResolveProviderFromString(s string) internaltypes.APIProvider
- type Client
- type Config
- type DiscoveryResult
- type FetchedModel
- type ModelInfo
- type ProviderInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllProvidersInfo ¶
func AllProvidersInfo() map[internaltypes.APIProvider]ProviderInfo
AllProvidersInfo returns the catalogue: every provider with its models.
func DefaultBaseURL ¶
DefaultBaseURL returns the default API base URL for a provider. These are sync/discovery URLs (no /v1 suffix); client endpoints live in config.go.
func NeedsCatalogReseed ¶
NeedsCatalogReseed returns true when none of the supplied model IDs exist in the provider's static catalog — meaning models from the wrong provider were seeded, or the list is empty.
func ResolveProviderFromString ¶
func ResolveProviderFromString(s string) internaltypes.APIProvider
ResolveProviderFromString turns a provider name as a user may write it (for example "claude", "gpt", "aws") into a provider.
Types ¶
type Client ¶
type Client = internalproviders.Client
Client represents an API client
func NewClient ¶
func NewClient(apiKey string, providerType internaltypes.APIProvider) *Client
NewClient creates a new API client
func NewClientWithConfig ¶
NewClientWithConfig builds a provider client from an explicit Config (provider type, base URL, etc.) rather than just a provider type - needed by callers resolving a specific org/platform provider setting (custom base URL, self-hosted endpoint) instead of using provider defaults.
type Config ¶
type Config = internalproviders.Config
Config is the connection settings of a provider: its API key, base URL, region and project, the aliases that map a short model name to a model identifier, custom headers, and the routing policy.
func GetProviderConfig ¶
func GetProviderConfig(provider internaltypes.APIProvider) *Config
GetProviderConfig returns a copy of the default configuration of a provider, which the caller can complete with a key or override, or nil when the provider has none.
type DiscoveryResult ¶
type DiscoveryResult = internalproviders.DiscoveryResult
DiscoveryResult reports the availability and authentication status of one provider.
func DiscoverProviders ¶
func DiscoverProviders(ctx context.Context) []DiscoveryResult
DiscoverProviders scans the environment for configured providers. It checks known env vars and pings Ollama's local endpoint. Results are sorted by recommendation priority; available providers appear before unavailable ones.
The context is used for the Ollama HTTP health check only.
type FetchedModel ¶
type FetchedModel = internalproviders.FetchedModel
FetchedModel is a provider-neutral model description returned by FetchModels and StaticModels. Callers convert it to their own storage type.
func FetchModels ¶
func FetchModels(ctx context.Context, providerName, baseURL, apiKey string) ([]FetchedModel, error)
FetchModels retrieves the live model list from a provider API. For Ollama it calls /api/tags and enriches each model via /api/show. For OpenAI-compatible providers it calls /v1/models. Returns an error so the caller can fall back to StaticModels.
func StaticModels ¶
func StaticModels(providerName string) []FetchedModel
StaticModels returns the hardcoded catalog for a provider. Returns nil for Ollama, which has no static model list (100% dynamic).
type ModelInfo ¶
type ModelInfo = internalproviders.ModelInfo
ModelInfo describes a single model offered by a provider. Capabilities contains fine-grained per-model feature flags. The Pricing field is a legacy string; structured pricing lives in model.Metadata.
func GetModelInfo ¶
func GetModelInfo(provider internaltypes.APIProvider, model string) (ModelInfo, bool)
GetModelInfo returns the catalogue entry of a model of a provider, matched on its exact identifier, and false when there is none.
type ProviderInfo ¶
type ProviderInfo = internalproviders.ProviderInfo
ProviderInfo describes a provider of the catalogue: its name, how it authenticates, whether it accepts images and supports prompt caching, and the models it offers.