providercatalog

package
v0.22.4 Latest Latest
Warning

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

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

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

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 OnboardingRank added in v0.21.14

func OnboardingRank(id string) (int, bool)

OnboardingRank reports a provider's position in the current catalog's onboarding order.

func RefreshFromRemote

func RefreshFromRemote(ctx context.Context, url string) error

func RefreshFromRemoteAsync

func RefreshFromRemoteAsync(url string)

func RefreshFromRemoteWithin added in v0.21.14

func RefreshFromRemoteWithin(timeout time.Duration)

RefreshFromRemoteWithin refreshes the catalog, waiting at most timeout. Setup flows call it so a fresh install sees current recommendations; on failure the embedded catalog stays in use.

func SetCatalog

func SetCatalog(catalog Catalog)

Types

type Catalog

type Catalog struct {
	UpdatedAt string `json:"updated_at"`
	Source    string `json:"source"`
	// OnboardingOrder lists provider IDs in the order setup surfaces offer
	// them. It lives in the catalog so it updates with the remote refresh.
	OnboardingOrder []string   `json:"onboarding_order,omitempty"`
	Providers       []Provider `json:"providers"`
}

func Current

func Current() Catalog

func (Catalog) OnboardingProviders added in v0.21.14

func (c Catalog) OnboardingProviders() []Provider

OnboardingProviders returns the providers in onboarding order: those named in OnboardingOrder first, in that order, then the rest in catalog order.

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"`
}

func FindProvider

func FindProvider(id string) (Provider, bool)

Jump to

Keyboard shortcuts

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