Documentation
¶
Overview ¶
Package providercatalog is the curated UX layer for provider onboarding — friendly descriptions, signup URLs, API-key help text, recommended-model justifications. ONE combined providers.json, shipped embedded and refreshable from raw.githubusercontent.com/.../pkg/providercatalog/providers.json.
Lifecycle:
- Embedded at compile time (//go:embed providers.json).
- Refreshed weekly by .github/workflows/provider-catalog-refresh.yml, which runs cmd/refresh_provider_catalog to query provider APIs and update the checked-in JSON via a PR.
IMPORTANT — distinguish from pkg/providerregistry, the sister system with adjacent but DIFFERENT concerns:
- pkg/providercatalog (this package): UX/copy. Used by onboarding menus, the model picker description blurbs, signup/help text.
- pkg/providerregistry: per-provider TECHNICAL CONFIG (endpoint, auth, streaming, retry, cost) that the API client uses.
They share an id/name and a model list shape but otherwise serve different consumers and have separate publish workflows. Don't merge them without a roadmap entry.
Index ¶
- func CatalogURL() string
- func FindModelPricing(providerID, modelID string) (inputPerM, outputPerM, cachedPerM float64, ok bool)
- func RefreshFromRemote(ctx context.Context, url string) error
- func RefreshFromRemoteAsync(url string)
- func SetCatalog(catalog Catalog)
- type Catalog
- type Model
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatalogURL ¶
func CatalogURL() string
func FindModelPricing ¶ added in v0.16.19
func FindModelPricing(providerID, modelID string) (inputPerM, outputPerM, cachedPerM float64, ok bool)
FindModelPricing returns the embedded-catalog pricing (per 1M tokens) for a (providerID, modelID) pair. Returns ok=false when the provider or model is unknown, or when the catalog entry carries no pricing. Used as a fallback by the cost-estimation path when the live API / model registry don't report pricing (common for providers like DeepSeek whose /v1/models endpoint omits cost fields).
func RefreshFromRemoteAsync ¶
func RefreshFromRemoteAsync(url string)
func SetCatalog ¶
func SetCatalog(catalog Catalog)
Types ¶
type Catalog ¶
type Model ¶
type Model struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
ContextLength int `json:"context_length,omitempty"`
Tags []string `json:"tags,omitempty"`
InputCost float64 `json:"input_cost,omitempty"`
OutputCost float64 `json:"output_cost,omitempty"`
CachedInputCost float64 `json:"cached_input_cost,omitempty"`
}
type Provider ¶
type Provider struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
SetupHint string `json:"setup_hint,omitempty"`
DocsURL string `json:"docs_url,omitempty"`
SignupURL string `json:"signup_url,omitempty"`
APIKeyLabel string `json:"api_key_label,omitempty"`
APIKeyHelp string `json:"api_key_help,omitempty"`
Recommended bool `json:"recommended,omitempty"`
DefaultModel string `json:"default_model,omitempty"`
RecommendedModel string `json:"recommended_model,omitempty"`
RecommendedModelWhy string `json:"recommended_model_why,omitempty"`
Models []Model `json:"models,omitempty"`
}