catalog

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package catalog defines eyrie's model catalog: the versioned set of known providers and their model entries, the bootstrap (built-in) catalog, and helpers to compile and query catalog data (e.g. resolving model entries for a given provider).

Index

Constants

View Source
const (
	CatalogV1SchemaVersion = "model-catalog/v1"
	// DefaultCatalogV1URL is the published model-catalog/v1 document.
	// Override with EYRIE_MODEL_CATALOG_URL or LoadCatalogV1Options.RemoteURL.
	DefaultCatalogV1URL = "https://langdag.com/model-catalog/v1/catalog.json"
	EnvModelCatalogURL  = "EYRIE_MODEL_CATALOG_URL"
)
View Source
const LiveCatalogStaleDuration = 24 * time.Hour

LiveCatalogStaleDuration is how long a cache remains fresh after live provider APIs were merged.

Variables

View Source
var DefaultDeploymentEnvFallbacks = func() map[string][]EnvFallbackV1 {
	result := make(map[string][]EnvFallbackV1, len(registry.DeploymentEnvFallbacks())+len(extraDeploymentEnvFallbacks))
	for id, fbs := range registry.DeploymentEnvFallbacks() {
		var converted []EnvFallbackV1
		for _, fb := range fbs {
			converted = append(converted, EnvFallbackV1{Field: fb.Field, Env: fb.Env})
		}
		result[id] = converted
	}
	for id, fbs := range extraDeploymentEnvFallbacks {
		if _, ok := result[id]; !ok {
			result[id] = fbs
		}
	}
	return result
}()

DefaultDeploymentEnvFallbacks seeds env_fallbacks per deployment until the published catalog includes them.

View Source
var DeprecatedModels = map[string]DeprecationEntry{
	"claude-3-opus": {
		ModelName:       "Claude 3 Opus",
		RetirementDates: map[string]string{"anthropic": "January 5, 2026"},
	},
	"claude-3-7-sonnet": {
		ModelName:       "Claude 3.7 Sonnet",
		RetirementDates: map[string]string{"anthropic": "February 19, 2026"},
	},
	"claude-3-5-haiku": {
		ModelName:       "Claude 3.5 Haiku",
		RetirementDates: map[string]string{"anthropic": "February 19, 2026"},
	},
}

DeprecatedModels lists deprecated models and their per-provider retirement dates.

View Source
var ErrCatalogCacheRequired = errors.New("model catalog cache required")

ErrCatalogCacheRequired is returned when no valid ~/.eyrie/model_catalog.json exists. Run catalog discovery (hawk models refresh / eyrie catalog discover) to populate the cache.

View Source
var ModelTierAliases = []ModelTier{TierSonnet, TierHaiku, TierOpus}

ModelTierAliases lists all valid tier names.

Functions

func APIKeyEnvsForProvider added in v0.1.1

func APIKeyEnvsForProvider(compiled *CompiledCatalogV1, providerID string) []string

APIKeyEnvsForProvider lists API key env var names for a provider from deployment env_fallbacks.

func AllModelProvidersV1 added in v0.1.3

func AllModelProvidersV1(compiled *CompiledCatalogV1) []string

AllModelProvidersV1 lists canonical model owner providers in the catalog.

func AnthropicNameToCanonical

func AnthropicNameToCanonical(name string) string

AnthropicNameToCanonical normalizes an Anthropic model ID to its canonical short name.

func BootstrapSource added in v0.1.1

func BootstrapSource() string

BootstrapSource returns the provenance label for the embedded catalog seed.

func CacheInfo added in v0.1.1

func CacheInfo(cachePath string) (exists bool, modTime time.Time, size int64, err error)

CacheInfo reports on-disk cache metadata when present.

func CanonicalModelForProviderNative added in v0.1.1

func CanonicalModelForProviderNative(compiled *CompiledCatalogV1, providerID, modelID string) (string, bool)

CanonicalModelForProviderNative maps a picker native id to the canonical model for that provider's deployment, without using global catalog aliases (e.g. mimo-v2.5-pro → xiaomi, not opencodego).

func CanonicalProviderID added in v0.1.1

func CanonicalProviderID(providerID string) string

CanonicalProviderID normalizes legacy provider aliases (e.g. gemini -> google).

func CheapestModelForProviderV1 added in v0.1.3

func CheapestModelForProviderV1(compiled *CompiledCatalogV1, provider, fallback string) string

CheapestModelForProviderV1 returns the lowest known input-priced model for a provider.

func CredentialStatusForProvider added in v0.1.1

func CredentialStatusForProvider(compiled *CompiledCatalogV1, providerID string) string

CredentialStatusForProvider reports whether a provider needs an API key (local vs required). For set/empty status use hawk config.EnvKeyStatus or credentials.HasSecret — catalog does not read env.

func DefaultCachePath added in v0.1.1

func DefaultCachePath() string

DefaultCachePath returns the shared model catalog cache location.

func DeploymentIDForLiveCatalogKey added in v0.1.1

func DeploymentIDForLiveCatalogKey(catalogKey string) string

DeploymentIDForLiveCatalogKey maps a live fetch catalog key to a deployment ID.

func DiscoveryEnvKeyNames added in v0.1.1

func DiscoveryEnvKeyNames(ctx context.Context) []string

DiscoveryEnvKeyNames returns env var names used for credential discovery from the catalog.

func DiscoveryEnvKeysFromCatalog added in v0.1.1

func DiscoveryEnvKeysFromCatalog(compiled *CompiledCatalogV1) []string

DiscoveryEnvKeysFromCatalog returns env var names needed for catalog discovery (API keys, base URLs) from deployment env_fallbacks in the compiled catalog.

func DisplayModelLabel added in v0.1.1

func DisplayModelLabel(id, displayName string) string

DisplayModelLabel returns a UI-friendly model name. OpenRouter latest aliases use a leading ~ in the API id (e.g. ~anthropic/claude-haiku-latest); strip it for display only.

func DisplayModelOwner added in v0.1.1

func DisplayModelOwner(owner, id string, liveMetadata ...json.RawMessage) string

DisplayModelOwner returns a UI-friendly owner slug without OpenRouter ~ prefixes.

func EnsureCredentialRegistryInCatalog added in v0.1.1

func EnsureCredentialRegistryInCatalog(c *CatalogV1)

EnsureCredentialRegistryInCatalog merges registry providers/deployments into catalog v1.

func EnsureDeploymentEnvFallbacks added in v0.1.1

func EnsureDeploymentEnvFallbacks(c *CatalogV1)

EnsureDeploymentEnvFallbacks fills missing env_fallbacks from the embedded seed. Published catalogs with env_fallbacks set are left unchanged.

func EnvVarsForDeployment added in v0.1.1

func EnvVarsForDeployment(deploymentID string) []string

EnvVarsForDeployment returns env var names for a deployment ID from the seed catalog.

func FetchLiveProviderCatalog added in v0.1.1

func FetchLiveProviderCatalog(env map[string]string) (ModelCatalog, []LiveProviderEnrichment)

FetchLiveProviderCatalog enriches catalog from live provider list APIs.

func FirstModelForProvider added in v0.1.1

func FirstModelForProvider(compiled *CompiledCatalogV1, providerID string) string

FirstModelForProvider returns the first canonical model ID for a provider from compiled catalog.

func GatewayForModel added in v0.1.1

func GatewayForModel(compiled *CompiledCatalogV1, modelID string) string

GatewayForModel returns the setup gateway that serves a model (e.g. openrouter for openrouter/auto).

func GetModelDeprecationWarning

func GetModelDeprecationWarning(modelID, provider string) string

GetModelDeprecationWarning returns a deprecation warning or empty string.

func GetModelMarketingName

func GetModelMarketingName(modelID string) string

GetModelMarketingName returns the marketing display name for a model ID.

func IsBootstrapCatalog added in v0.1.1

func IsBootstrapCatalog(c *CatalogV1) bool

IsBootstrapCatalog reports whether c is the empty wiring-only catalog.

func IsLiveOnlyProvider added in v0.1.1

func IsLiveOnlyProvider(providerID string) bool

IsLiveOnlyProvider reports whether a provider uses live API discovery only. All providers are now fully dynamic.

func IsSetupGateway added in v0.1.1

func IsSetupGateway(providerID string) bool

IsSetupGateway reports whether id is a registered API-key gateway (not an aggregator owner slug).

func LiveDiscoverableDeploymentIDs added in v0.1.1

func LiveDiscoverableDeploymentIDs() []string

LiveDiscoverableDeploymentIDs returns provider keys with live model-list APIs.

func ModelForRoleV1 added in v0.1.3

func ModelForRoleV1(compiled *CompiledCatalogV1, roles ModelRoleAssignments, role ModelRole) string

ModelForRoleV1 resolves a role assignment with coder then catalog fallback.

func ModelOwner added in v0.1.1

func ModelOwner(entry ModelCatalogEntry) string

ModelOwner returns the upstream vendor for a catalog row (owned_by or id prefix).

func MostExpensiveModelForProviderV1 added in v0.1.3

func MostExpensiveModelForProviderV1(compiled *CompiledCatalogV1, provider, fallback string) string

MostExpensiveModelForProviderV1 returns the highest known input-priced model for a provider.

func PreferredModelsForTierV1 added in v0.1.3

func PreferredModelsForTierV1(compiled *CompiledCatalogV1, primaryProvider string, tier ModelTier, limit int) []string

PreferredModelsForTierV1 returns unique preferred models for a tier, starting with primaryProvider and then following the registry chat preference order.

func PreferredProviderModelV1 added in v0.1.3

func PreferredProviderModelV1(compiled *CompiledCatalogV1, provider string, tier ModelTier, fallback string) string

PreferredProviderModelV1 returns the preferred model for provider and tier.

func PrimaryAPIKeyEnvForDeployment added in v0.1.1

func PrimaryAPIKeyEnvForDeployment(compiled *CompiledCatalogV1, deploymentID string) string

PrimaryAPIKeyEnvForDeployment returns the primary API key env var for a deployment ID.

func PrimaryAPIKeyEnvForProvider added in v0.1.1

func PrimaryAPIKeyEnvForProvider(compiled *CompiledCatalogV1, providerID string) string

PrimaryAPIKeyEnvForProvider returns the preferred API key env var for a provider.

func PrimaryModelV1 added in v0.1.3

func PrimaryModelV1(compiled *CompiledCatalogV1) string

PrimaryModelV1 returns a stable best-effort model from chat-preferred providers.

func ProviderDefaultModelV1 added in v0.1.3

func ProviderDefaultModelV1(compiled *CompiledCatalogV1, provider, fallback string) string

ProviderDefaultModelV1 returns the provider's first catalog model.

func ProviderDisplayName added in v0.1.1

func ProviderDisplayName(providerID string) string

ProviderDisplayName returns UI label from registry.

func ProviderForModelV1 added in v0.1.3

func ProviderForModelV1(compiled *CompiledCatalogV1, modelName string) string

ProviderForModelV1 returns the canonical owner provider for modelName.

func ProviderIDsFromCompiled added in v0.1.1

func ProviderIDsFromCompiled(compiled *CompiledCatalogV1) []string

ProviderIDsFromCompiled lists provider IDs from catalog providers and deployments.

func ResolvedRemoteCatalogURL added in v0.1.1

func ResolvedRemoteCatalogURL(explicit string) string

ResolvedRemoteCatalogURL returns explicit URL, else EYRIE_MODEL_CATALOG_URL, else DefaultCatalogV1URL.

func SanitizeCatalogV1Pricing added in v0.1.1

func SanitizeCatalogV1Pricing(c *CatalogV1)

SanitizeCatalogV1Pricing drops invalid rate dimensions (e.g. negative OpenRouter prices).

func SpecByEnvVar added in v0.1.1

func SpecByEnvVar(env string) (registry.ProviderSpec, bool)

SpecByEnvVar returns the registry ProviderSpec for the given credential env var.

func SpecByProviderID added in v0.1.1

func SpecByProviderID(id string) (registry.ProviderSpec, bool)

SpecByProviderID returns the registry ProviderSpec for the given provider ID or catalog alias.

func SplitOfferingIDV1 added in v0.1.1

func SplitOfferingIDV1(id string) (deploymentID, nativeModelID string, ok bool)

func ValidateCatalogV1 added in v0.1.1

func ValidateCatalogV1(c *CatalogV1) error

func WriteCatalogV1Cache added in v0.1.1

func WriteCatalogV1Cache(cachePath string, c *CatalogV1) error

Types

type APIProtocolV1 added in v0.1.1

type APIProtocolV1 struct {
	ID          string               `json:"id"`
	Name        string               `json:"name"`
	Description string               `json:"description,omitempty"`
	Provenance  *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type CapabilitySetV1 added in v0.1.1

type CapabilitySetV1 struct {
	ServerTools            map[string]CapabilityState `json:"server_tools,omitempty"`
	FunctionCalling        CapabilityState            `json:"function_calling,omitempty"`
	ExplicitThinkingBudget CapabilityState            `json:"explicit_thinking_budget,omitempty"`
	AdaptiveThinking       CapabilityState            `json:"adaptive_thinking,omitempty"`
	Effort                 CapabilityState            `json:"effort,omitempty"`
	StructuredOutput       CapabilityState            `json:"structured_output,omitempty"`
	CodeExecution          CapabilityState            `json:"code_execution,omitempty"`
	Citations              CapabilityState            `json:"citations,omitempty"`
	PDFInput               CapabilityState            `json:"pdf_input,omitempty"`
	ImageInput             CapabilityState            `json:"image_input,omitempty"`
	MaxInputTokens         int                        `json:"max_input_tokens,omitempty"`
	MaxOutputTokens        int                        `json:"max_output_tokens,omitempty"`
	ThinkingTypes          []string                   `json:"thinking_types,omitempty"`
	EffortLevels           []string                   `json:"effort_levels,omitempty"`
}

type CapabilityState added in v0.1.1

type CapabilityState string
const (
	CapabilitySupported   CapabilityState = "supported"
	CapabilityUnsupported CapabilityState = "unsupported"
	CapabilityUnknown     CapabilityState = "unknown"
)

type CatalogDiagnosticV1 added in v0.1.1

type CatalogDiagnosticV1 struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type CatalogProvenanceV1 added in v0.1.1

type CatalogProvenanceV1 struct {
	Source     string    `json:"source"`
	SourceURL  string    `json:"source_url,omitempty"`
	ObservedAt time.Time `json:"observed_at,omitempty"`
}

type CatalogV1 added in v0.1.1

type CatalogV1 struct {
	SchemaVersion     string                    `json:"schema_version"`
	GeneratedAt       time.Time                 `json:"generated_at"`
	StaleAfter        time.Time                 `json:"stale_after"`
	Providers         map[string]ProviderV1     `json:"providers"`
	APIProtocols      map[string]APIProtocolV1  `json:"api_protocols"`
	Deployments       map[string]DeploymentV1   `json:"deployments"`
	Models            map[string]ModelV1        `json:"models"`
	Offerings         []ModelOfferingV1         `json:"offerings"`
	OfferingTemplates []ModelOfferingTemplateV1 `json:"offering_templates,omitempty"`
	Aliases           map[string]string         `json:"aliases,omitempty"`
	Provenance        *CatalogProvenanceV1      `json:"provenance,omitempty"`
}

CatalogV1 separates model ownership from the API protocol and deployment used to call the model. It is intentionally data-only; adapters remain code.

func BootstrapCatalogV1 added in v0.1.1

func BootstrapCatalogV1() CatalogV1

BootstrapCatalogV1 returns deployment/provider wiring only — no chat models. Chat models come from the published catalog cache and live provider discovery.

func CatalogV1FromLegacy added in v0.1.1

func CatalogV1FromLegacy(legacy ModelCatalog) CatalogV1

func DefaultCatalogV1 added in v0.1.1

func DefaultCatalogV1() CatalogV1

DefaultCatalogV1 returns the bootstrap catalog (deployments only, no models).

func FetchRemoteCatalogV1 added in v0.1.1

func FetchRemoteCatalogV1(ctx context.Context, opts LoadCatalogV1Options) (*CatalogV1, error)

func ParseCatalogV1 added in v0.1.1

func ParseCatalogV1(data []byte) (*CatalogV1, error)

func TestSeedCatalogV1 added in v0.1.1

func TestSeedCatalogV1() CatalogV1

TestSeedCatalogV1 returns a v1 catalog built from embedded test fixtures.

type CompiledCatalogV1 added in v0.1.1

type CompiledCatalogV1 struct {
	Catalog                   *CatalogV1
	ProvidersByID             map[string]ProviderV1
	APIProtocolsByID          map[string]APIProtocolV1
	DeploymentsByID           map[string]DeploymentV1
	ModelsByID                map[string]ModelV1
	OfferingsByID             map[string]ModelOfferingV1
	OfferingsByCanonicalModel map[string][]ModelOfferingV1
	OfferingsByDeployment     map[string][]ModelOfferingV1
	TemplatesByCanonicalModel map[string][]ModelOfferingTemplateV1
	Diagnostics               []CatalogDiagnosticV1
}

func CompileCatalogV1 added in v0.1.1

func CompileCatalogV1(c *CatalogV1) (*CompiledCatalogV1, error)

func CompileTestCatalog added in v0.1.1

func CompileTestCatalog() (*CompiledCatalogV1, error)

CompileTestCatalog builds a compiled catalog from built-in provider model lists (tests and dev fixtures).

func LoadCatalogForDiscovery added in v0.1.1

func LoadCatalogForDiscovery(ctx context.Context) (*CompiledCatalogV1, error)

LoadCatalogForDiscovery returns the cached catalog or bootstrap wiring (no network).

func LoadCatalogV1 added in v0.1.1

func LoadCatalogV1(ctx context.Context, opts LoadCatalogV1Options) (*CompiledCatalogV1, error)

func LoadValidCatalogCache added in v0.1.1

func LoadValidCatalogCache(cachePath string) (*CompiledCatalogV1, bool)

LoadValidCatalogCache reads and compiles a non-bootstrap catalog cache from disk.

func (*CompiledCatalogV1) CanonicalModelForAliasOrID added in v0.1.1

func (c *CompiledCatalogV1) CanonicalModelForAliasOrID(value string) (string, bool)

func (*CompiledCatalogV1) CapabilitiesForModel added in v0.1.1

func (c *CompiledCatalogV1) CapabilitiesForModel(modelID, deploymentID string) CapabilitySetV1

CapabilitiesForModel returns the capability set for a model on a deployment. If deploymentID is empty, returns capabilities from the first offering found. Returns empty CapabilitySetV1 if the model is not in the catalog.

func (*CompiledCatalogV1) OfferingForDeployment added in v0.1.1

func (c *CompiledCatalogV1) OfferingForDeployment(canonicalModelID, deploymentID string) (ModelOfferingV1, bool)

type CredentialV1 added in v0.1.1

type CredentialV1 struct {
	Field    string `json:"field"`
	Secret   bool   `json:"secret,omitempty"`
	Required bool   `json:"required,omitempty"`
}

type Credentials added in v0.1.1

type Credentials struct {
	APIKeys map[string]string
}

Credentials carries API keys and related env (base URLs) for provider-backed catalog discovery. Keys use standard env var names (e.g. OPENROUTER_API_KEY). Populate via config.DiscoveryCredentials. or pass an explicit map from hawk — do not hardcode provider lists in hawk.

func (Credentials) Env added in v0.1.1

func (c Credentials) Env() map[string]string

Env returns a copy of the key map suitable for catalog discovery.

func (*Credentials) Merge added in v0.1.1

func (c *Credentials) Merge(other Credentials)

MergeCredentials merges additional keys into c (later keys win).

type DeploymentV1 added in v0.1.1

type DeploymentV1 struct {
	ID                     string               `json:"id"`
	Name                   string               `json:"name"`
	ProviderID             string               `json:"provider_id"`
	APIProtocolID          string               `json:"api_protocol_id"`
	AdapterConstructor     string               `json:"adapter_constructor"`
	CredentialRequirements []CredentialV1       `json:"credential_requirements,omitempty"`
	EnvFallbacks           []EnvFallbackV1      `json:"env_fallbacks,omitempty"`
	NativeModelIDSource    NativeModelIDSource  `json:"native_model_id_source"`
	ModelMappingsRequired  bool                 `json:"model_mappings_required,omitempty"`
	Local                  bool                 `json:"local,omitempty"`
	Provenance             *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type DeprecationEntry

type DeprecationEntry struct {
	ModelName       string
	RetirementDates map[string]string // provider → date string, empty = not deprecated
}

DeprecationEntry holds deprecation metadata for a model.

type EnvFallbackV1 added in v0.1.1

type EnvFallbackV1 struct {
	Field string   `json:"field"`
	Env   []string `json:"env"`
}

type LiveProviderEnrichment added in v0.1.1

type LiveProviderEnrichment struct {
	Provider   string `json:"provider"`
	ModelCount int    `json:"model_count"`
	Error      string `json:"error,omitempty"`
	DurationMs int64  `json:"duration_ms,omitempty"`
}

LiveProviderEnrichment records a live provider API fetch during catalog discovery.

type LoadCatalogV1Options added in v0.1.1

type LoadCatalogV1Options struct {
	CachePath     string
	RemoteURL     string
	RefreshRemote bool
	// RequireCache fails when no valid cache file exists (production hawk/eyrie path).
	RequireCache bool
	HTTPClient   *http.Client
	Timeout      time.Duration
}

type ModelCatalog

type ModelCatalog struct {
	UpdatedAt string                         `json:"updated_at"`
	Source    string                         `json:"source"`
	Providers map[string][]ModelCatalogEntry `json:"providers"`
}

ModelCatalog holds the full model catalog with per-provider entries.

type ModelCatalogEntry

type ModelCatalogEntry struct {
	ID               string          `json:"id"`
	InputPricePer1M  float64         `json:"input_price_per_1m"`
	OutputPricePer1M float64         `json:"output_price_per_1m"`
	ContextWindow    int             `json:"context_window"`
	MaxOutput        int             `json:"max_output"`
	ServerTools      []string        `json:"server_tools,omitempty"`
	DisplayName      string          `json:"display_name,omitempty"`
	Description      string          `json:"description,omitempty"`
	Owner            string          `json:"owner,omitempty"` // upstream vendor (API owned_by)
	LiveMetadata     json.RawMessage `json:"live_metadata,omitempty"`
}

ModelCatalogEntry represents a single model in the catalog.

func FetchLiveModelEntriesForProvider added in v0.1.1

func FetchLiveModelEntriesForProvider(env map[string]string, providerID string) ([]ModelCatalogEntry, error)

FetchLiveModelEntriesForProvider lists models from one provider's live API with full JSON metadata.

func FetchOllamaModels added in v0.1.1

func FetchOllamaModels(env map[string]string) ([]ModelCatalogEntry, error)

FetchOllamaModels lists models installed on a running Ollama instance.

func LiveEntriesToCatalog added in v0.1.1

func LiveEntriesToCatalog(in []live.Entry) []ModelCatalogEntry

LiveEntriesToCatalog converts live fetch rows to catalog entries.

func ModelEntriesForProvider added in v0.1.1

func ModelEntriesForProvider(compiled *CompiledCatalogV1, provider string) []ModelCatalogEntry

ModelEntriesForProvider lists models from a compiled v1 catalog for one provider. New models appear here automatically when the eyrie catalog is updated — hosts must not hardcode IDs.

type ModelConfig

type ModelConfig map[string]ModelName

ModelConfig maps each APIProvider to a model name.

type ModelCostTier added in v0.1.3

type ModelCostTier int

ModelCostTier is a relative cost band for model selection.

const (
	// CostTierCheap is appropriate for short, low-risk, or summarization work.
	CostTierCheap ModelCostTier = iota
	// CostTierMid is the default balanced cost band.
	CostTierMid
	// CostTierExpensive is appropriate for complex planning or generation work.
	CostTierExpensive
)

func ModelCostTierOf added in v0.1.3

func ModelCostTierOf(compiled *CompiledCatalogV1, modelName string) ModelCostTier

ModelCostTierOf resolves a model's cost tier from catalog family and pricing data.

type ModelKey

type ModelKey string

ModelKey identifies a specific model version config.

type ModelName

type ModelName = string

ModelName is a model identifier string.

func GetPreferredProviderModel

func GetPreferredProviderModel(provider string, _ ModelTier, catalog *ModelCatalog) ModelName

GetPreferredProviderModel returns the preferred model for a provider/tier from the catalog. Returns "" if catalog is nil or has no models for this provider. The tier parameter is currently unused; all models are returned equally.

func GetProviderDefaultModel

func GetProviderDefaultModel(provider string, catalog *ModelCatalog) ModelName

GetProviderDefaultModel returns the first model from the catalog for a provider. Returns "" if no catalog data is available.

type ModelOfferingTemplateV1 added in v0.1.1

type ModelOfferingTemplateV1 struct {
	ID                  string               `json:"id"`
	CanonicalModelID    string               `json:"canonical_model_id"`
	DeploymentID        string               `json:"deployment_id"`
	NativeModelIDSource NativeModelIDSource  `json:"native_model_id_source"`
	MappingRequired     bool                 `json:"mapping_required"`
	Capabilities        CapabilitySetV1      `json:"capabilities,omitempty"`
	Pricing             PricingV1            `json:"pricing"`
	Provenance          *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type ModelOfferingV1 added in v0.1.1

type ModelOfferingV1 struct {
	ID               string               `json:"id"`
	CanonicalModelID string               `json:"canonical_model_id"`
	DeploymentID     string               `json:"deployment_id"`
	NativeModelID    string               `json:"native_model_id"`
	Capabilities     CapabilitySetV1      `json:"capabilities,omitempty"`
	Pricing          PricingV1            `json:"pricing"`
	LiveMetadata     json.RawMessage      `json:"live_metadata,omitempty"`
	Provenance       *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type ModelRole added in v0.1.3

type ModelRole string

ModelRole identifies the purpose of a model in a multi-model workflow.

const (
	ModelRolePlanner  ModelRole = "planner"
	ModelRoleCoder    ModelRole = "coder"
	ModelRoleReviewer ModelRole = "reviewer"
	ModelRoleCommit   ModelRole = "commit"
)

type ModelRoleAssignments added in v0.1.3

type ModelRoleAssignments struct {
	Planner  string `json:"planner,omitempty"`
	Coder    string `json:"coder,omitempty"`
	Reviewer string `json:"reviewer,omitempty"`
	Commit   string `json:"commit,omitempty"`
}

ModelRoleAssignments maps workflow roles to concrete model IDs.

func DefaultModelRolesV1 added in v0.1.3

func DefaultModelRolesV1(compiled *CompiledCatalogV1, primaryModel string) ModelRoleAssignments

DefaultModelRolesV1 uses the primary model for interactive roles and the cheapest same-provider model for commit/summarization work when catalog data is available.

type ModelTier

type ModelTier string

ModelTier represents opus/sonnet/haiku tiers.

const (
	TierOpus   ModelTier = "opus"
	TierSonnet ModelTier = "sonnet"
	TierHaiku  ModelTier = "haiku"
)

type ModelV1 added in v0.1.1

type ModelV1 struct {
	ID            string               `json:"id"`
	ProviderID    string               `json:"provider_id"`
	Name          string               `json:"name"`
	Family        string               `json:"family,omitempty"`
	ContextWindow int                  `json:"context_window,omitempty"`
	MaxOutput     int                  `json:"max_output,omitempty"`
	Aliases       []string             `json:"aliases,omitempty"`
	Provenance    *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type NativeModelIDSource added in v0.1.1

type NativeModelIDSource string
const (
	NativeModelIDCatalogKnown   NativeModelIDSource = "catalog_known"
	NativeModelIDDiscovered     NativeModelIDSource = "discovered"
	NativeModelIDUserConfigured NativeModelIDSource = "user_configured"
	NativeModelIDCatalogOrUser  NativeModelIDSource = "catalog_or_user_configured"
)

type PricingStatus added in v0.1.1

type PricingStatus string
const (
	PricingKnown   PricingStatus = "known"
	PricingPartial PricingStatus = "partial"
	PricingUnknown PricingStatus = "unknown"
	PricingFree    PricingStatus = "free"
)

type PricingV1 added in v0.1.1

type PricingV1 struct {
	Status            PricingStatus      `json:"status"`
	Currency          string             `json:"currency,omitempty"`
	EffectiveAt       time.Time          `json:"effective_at,omitempty"`
	RatesPer1M        map[string]float64 `json:"rates_per_1m,omitempty"`
	MissingDimensions []string           `json:"missing_dimensions,omitempty"`
	Notes             []string           `json:"notes,omitempty"`
	Source            string             `json:"source,omitempty"`
}

type ProviderV1 added in v0.1.1

type ProviderV1 struct {
	ID          string               `json:"id"`
	Name        string               `json:"name"`
	Description string               `json:"description,omitempty"`
	HomepageURL string               `json:"homepage_url,omitempty"`
	Aliases     []string             `json:"aliases,omitempty"`
	Provenance  *CatalogProvenanceV1 `json:"provenance,omitempty"`
}

type RefreshResult added in v0.1.1

type RefreshResult struct {
	Compiled   *CompiledCatalogV1
	CachePath  string
	Source     string // remote, cache, embedded, remote+providers
	RemoteURL  string
	Refreshed  bool
	StaleAfter time.Time
	// RemoteRefreshed is true when the published remote catalog was fetched successfully.
	RemoteRefreshed bool
	// LiveProviders lists provider APIs queried with API keys (empty if none attempted).
	LiveProviders []LiveProviderEnrichment
}

RefreshResult summarizes a strict remote catalog refresh (eyrie published catalog).

func RefreshCatalogV1 added in v0.1.1

func RefreshCatalogV1(ctx context.Context, opts LoadCatalogV1Options) (*RefreshResult, error)

RefreshCatalogV1 fetches the published catalog, validates it, and writes the cache. Unlike LoadCatalogV1 with RefreshRemote, this fails when the remote fetch fails so callers never treat a stale cache as a successful refresh.

func (*RefreshResult) DiscoverReport added in v0.1.1

func (r *RefreshResult) DiscoverReport() string

DiscoverReport returns a multi-line report for `hawk models refresh` / `eyrie catalog discover`.

func (*RefreshResult) Summary added in v0.1.1

func (r *RefreshResult) Summary() string

Summary returns a one-line human summary for CLI output.

Directories

Path Synopsis
Package opencodego holds shared constants and helpers for the OpenCode Go gateway (https://opencode.ai/docs/go/).
Package opencodego holds shared constants and helpers for the OpenCode Go gateway (https://opencode.ai/docs/go/).
Package xiaomi resolves Xiaomi MiMo API base URLs for pay-as-you-go and Token Plan.
Package xiaomi resolves Xiaomi MiMo API base URLs for pay-as-you-go and Token Plan.
Package zai resolves Z.AI (Zhipu GLM) API base URLs for General (pay-as-you-go) and Coding Plan subscriptions, with full support for both OpenAI-compatible and Anthropic-compatible endpoints, plus International vs China regions.
Package zai resolves Z.AI (Zhipu GLM) API base URLs for General (pay-as-you-go) and Coding Plan subscriptions, with full support for both OpenAI-compatible and Anthropic-compatible endpoints, plus International vs China regions.

Jump to

Keyboard shortcuts

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