providers

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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

func DefaultBaseURL(providerName string) string

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 DefaultModelWithPolicy added in v1.11.0

func DefaultModelWithPolicy(provider internaltypes.APIProvider, policy ModelPolicy) (internaltypes.ModelIdentifier, bool)

DefaultModelWithPolicy returns the default large model of a provider under the host's policy.

func NeedsCatalogReseed

func NeedsCatalogReseed(providerName string, knownModelIDs []string) bool

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.

func SmallModelWithPolicy added in v1.11.0

func SmallModelWithPolicy(provider internaltypes.APIProvider, policy ModelPolicy) (string, bool)

SmallModelWithPolicy returns the default small model of a provider under the host's policy.

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

func NewClientWithConfig(apiKey string, config *Config) *Client

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 ModelDefaults added in v1.11.0

type ModelDefaults = internalproviders.ModelDefaults

ModelDefaults names the default large and small model of a provider as families of the models.dev catalog ("claude-sonnet") or exact model ids, tried in order.

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 ModelPolicy added in v1.11.0

type ModelPolicy = internalproviders.ModelPolicy

ModelPolicy is a set of ModelDefaults by provider. A host writes only what it changes: its entries are tried first and the runtime's after them, so an entry naming a model the catalog no longer has falls back to the runtime's choice. It is a value passed to the functions below; nothing is stored in the package.

func DefaultModelPolicy added in v1.11.0

func DefaultModelPolicy() ModelPolicy

DefaultModelPolicy returns a copy of the runtime's own default models, to read or complete.

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.

func ProviderInfoWithPolicy added in v1.11.0

func ProviderInfoWithPolicy(provider internaltypes.APIProvider, policy ModelPolicy) (ProviderInfo, bool)

ProviderInfoWithPolicy returns the catalogue entry of a provider with its models ordered under the host's policy: the default large model first, the small one last.

Jump to

Keyboard shortcuts

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