Documentation
¶
Index ¶
- Variables
- func CatalogFilePath() string
- func CatalogSyncAdapterSupported(adapter string) bool
- func CompatibleRosterAdapter(provider string) (string, bool)
- func DeleteProviderInstanceCatalog(instanceID string) error
- func GenerateCatalogKey(provider, apiBase, apiKey string) string
- func MaskAPIKeyValue(key string) string
- func ProviderCatalogPath(settings map[string]any) (string, error)
- func ResolveProviderCredentialReference(ref string) (string, error)
- func SaveCatalogs(store *CatalogStore) error
- func SaveProviderInstanceCatalog(instance *config.ProviderInstanceConfig, models []CatalogModel) error
- type AutoConnectResult
- type CatalogEntry
- type CatalogModel
- func CatalogModelsFromItems(items []compatibleCatalogModel) []CatalogModel
- func FilterAnonymousFreeModels(providerKind string, models []CatalogModel) []CatalogModel
- func ParseCompatibleCatalogModels(body []byte) ([]CatalogModel, error)
- func SyncCompatibleCatalog(ctx context.Context, input ProviderCatalogSyncInput, client *http.Client) ([]CatalogModel, error)
- func SyncNativeGitHubCopilotCatalog(ctx context.Context) ([]CatalogModel, error)
- type CatalogStore
- type CatalogSyncFunc
- type PingResult
- type ProviderCatalogSyncInput
- type ProviderRosterItem
Constants ¶
This section is empty.
Variables ¶
var AnonymousFreeModelIDs = map[string][]string{
"opencode_zen": {"ling-3.0-flash-fin-free", "muse-spark-1.2-contributor-free", "nemotron-3.5-lightning-free"},
"kilo_code": {"kilo-auto/free", "liquid/lfm-2.5-2.6b:free", "cohere/north-mini-code:free"},
"llm7": {"codestral-latest", "mistral-Nemo-Instruct-2407", "minimax-m2.7"},
"ovh_ai_endpoints": {"Qwen3.8-27B", "Mistral-Nemo-Instruct-2407", "gpt-oss-20b"},
"pollinations": {"openai-fast", "deepseek-reasoner"},
}
AnonymousFreeModelIDs lists known working free models for anonymous providers.
var InspectGitHubCopilotFunc = providers.InspectGitHubCopilot
InspectGitHubCopilotFunc points to the discovery function for GitHub Copilot. It can be overridden in tests.
Functions ¶
func CatalogFilePath ¶
func CatalogFilePath() string
CatalogFilePath returns the absolute path to the local model catalogs cache file.
func CatalogSyncAdapterSupported ¶
CatalogSyncAdapterSupported returns true if the adapter supports catalog discovery.
func CompatibleRosterAdapter ¶
CompatibleRosterAdapter returns the runtime adapter type for a given provider kind.
func DeleteProviderInstanceCatalog ¶
DeleteProviderInstanceCatalog removes catalog models for a specific instance.
func GenerateCatalogKey ¶
GenerateCatalogKey creates a deterministic key for a provider+base+key combination.
func MaskAPIKeyValue ¶
MaskAPIKeyValue masks an API key for display.
func ProviderCatalogPath ¶
ProviderCatalogPath determines the catalog URL path from settings or defaults to "/models".
func ResolveProviderCredentialReference ¶
ResolveProviderCredentialReference loads an access token from the auth store.
func SaveCatalogs ¶
func SaveCatalogs(store *CatalogStore) error
SaveCatalogs atomically writes the model catalogs cache to disk.
func SaveProviderInstanceCatalog ¶
func SaveProviderInstanceCatalog(instance *config.ProviderInstanceConfig, models []CatalogModel) error
SaveProviderInstanceCatalog saves catalog models for a specific instance.
Types ¶
type AutoConnectResult ¶
type AutoConnectResult struct {
OK bool `json:"ok"`
Total int `json:"total"`
Connected int `json:"connected"`
Verified int `json:"verified"`
Instances []string `json:"instances"`
}
AutoConnectResult reports the results of auto-connecting anonymous free providers.
func AutoConnectFree ¶
func AutoConnectFree(ctx context.Context, cfg *config.Config, client *http.Client, syncFunc CatalogSyncFunc) (*AutoConnectResult, error)
AutoConnectFree connects all verified anonymous free providers to config, queries their catalogs, and activates working free models.
func AutoConnectFreeAndSave ¶
func AutoConnectFreeAndSave(ctx context.Context, configPath string, client *http.Client, syncFunc CatalogSyncFunc) (*AutoConnectResult, error)
AutoConnectFreeAndSave connects free providers and saves the updated configuration to disk.
type CatalogEntry ¶
type CatalogEntry struct {
ID string `json:"id"`
InstanceID string `json:"instance_id,omitempty"`
Provider string `json:"provider"`
APIBase string `json:"api_base"`
APIKeyMask string `json:"api_key_mask"`
Models []CatalogModel `json:"models"`
FetchedAt string `json:"fetched_at"`
}
CatalogEntry is a saved list of upstream models fetched for a specific provider+key combination.
type CatalogModel ¶
type CatalogModel struct {
ID string `json:"id"`
OwnedBy string `json:"owned_by,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
}
CatalogModel represents a single model entry in a saved catalog.
func CatalogModelsFromItems ¶
func CatalogModelsFromItems(items []compatibleCatalogModel) []CatalogModel
CatalogModelsFromItems translates compatible items to CatalogModel list.
func FilterAnonymousFreeModels ¶
func FilterAnonymousFreeModels(providerKind string, models []CatalogModel) []CatalogModel
FilterAnonymousFreeModels narrows a catalog to verified free or community models.
func ParseCompatibleCatalogModels ¶
func ParseCompatibleCatalogModels(body []byte) ([]CatalogModel, error)
ParseCompatibleCatalogModels decodes JSON array or { "data": [...] } response.
func SyncCompatibleCatalog ¶
func SyncCompatibleCatalog(ctx context.Context, input ProviderCatalogSyncInput, client *http.Client) ([]CatalogModel, error)
SyncCompatibleCatalog queries an upstream provider's /models endpoint and parses the results.
func SyncNativeGitHubCopilotCatalog ¶
func SyncNativeGitHubCopilotCatalog(ctx context.Context) ([]CatalogModel, error)
SyncNativeGitHubCopilotCatalog queries the native GitHub Copilot model info.
type CatalogStore ¶
type CatalogStore struct {
Entries map[string]*CatalogEntry `json:"entries"`
}
CatalogStore holds all saved model catalogs.
func LoadCatalogs ¶
func LoadCatalogs() (*CatalogStore, error)
LoadCatalogs reads the model catalogs cache from disk.
type CatalogSyncFunc ¶
type CatalogSyncFunc func(ctx context.Context, input ProviderCatalogSyncInput) ([]CatalogModel, error)
CatalogSyncFunc queries models for a provider instance.
type PingResult ¶
type PingResult struct {
OK bool `json:"ok"`
InstanceID string `json:"instance_id"`
LatencyMS int64 `json:"latency_ms"`
ModelCount int `json:"model_count,omitempty"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
}
PingResult describes the outcome of probing an endpoint's reachability.
func Ping ¶
func Ping(ctx context.Context, instance *config.ProviderInstanceConfig, secret string, client *http.Client) PingResult
Ping probes an instance's reachability and measures round-trip latency.
func PingWithSync ¶
func PingWithSync(ctx context.Context, instance *config.ProviderInstanceConfig, secret string, client *http.Client, syncFunc CatalogSyncFunc) PingResult
PingWithSync probes an instance using a specified sync function or defaults to HTTP catalog sync.
type ProviderCatalogSyncInput ¶
type ProviderCatalogSyncInput struct {
InstanceID string
ProviderKind string
Adapter string
Protocol string
Endpoint string
AuthConnectionRef string
Headers map[string]string
Settings map[string]any
Secret string
}
ProviderCatalogSyncInput defines parameters for syncing models from an upstream provider.
func CatalogSyncInputFromInstance ¶
func CatalogSyncInputFromInstance(instance *config.ProviderInstanceConfig) ProviderCatalogSyncInput
CatalogSyncInputFromInstance converts a config.ProviderInstanceConfig to ProviderCatalogSyncInput.
type ProviderRosterItem ¶
type ProviderRosterItem struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Categories []string `json:"categories,omitempty"`
Adapter string `json:"adapter,omitempty"`
Protocol string `json:"protocol,omitempty"`
DefaultEndpoint string `json:"default_endpoint,omitempty"`
Compatibility string `json:"compatibility"`
AuthMethods []string `json:"auth_methods,omitempty"`
RequiresAPIKey bool `json:"requires_api_key"`
RequiresBaseURL bool `json:"requires_base_url"`
AnonymousAutomation bool `json:"anonymous_automation"`
OnboardingFields []string `json:"onboarding_fields,omitempty"`
Configured bool `json:"configured"`
InstanceCount int `json:"instance_count"`
ConfiguredInstances []string `json:"configured_instances,omitempty"`
}
ProviderRosterItem describes a provider from the curated registry and its local configuration status.
func ListRoster ¶
func ListRoster(cfg *config.Config) []ProviderRosterItem
ListRoster returns the complete list of curated providers, merged with studio defaults and configuration status.