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
- Variables
- func APIKeyEnvsForProvider(compiled *CompiledCatalog, providerID string) []string
- func AllModelProviders(compiled *CompiledCatalog) []string
- func AnthropicNameToCanonical(name string) string
- func BootstrapSource() string
- func CacheInfo(cachePath string) (exists bool, modTime time.Time, size int64, err error)
- func CanonicalModelForProviderNative(compiled *CompiledCatalog, providerID, modelID string) (string, bool)
- func CanonicalProviderID(providerID string) string
- func CheapestModelForProvider(compiled *CompiledCatalog, provider, fallback string) string
- func CredentialStatusForProvider(compiled *CompiledCatalog, providerID string) string
- func DefaultCachePath() string
- func DeploymentIDForLiveCatalogKey(catalogKey string) string
- func DiscoveryEnvKeyNames(ctx context.Context) []string
- func DiscoveryEnvKeysFromCatalog(compiled *CompiledCatalog) []string
- func DisplayModelLabel(id, displayName string) string
- func DisplayModelOwner(owner, id string, liveMetadata ...json.RawMessage) string
- func EnsureCredentialRegistryInCatalog(c *Catalog)
- func EnsureDeploymentEnvFallbacks(c *Catalog)
- func EnvVarsForDeployment(deploymentID string) []string
- func FetchLiveProviderCatalog(env map[string]string) (Catalog, []LiveProviderEnrichment)
- func FirstModelForProvider(compiled *CompiledCatalog, providerID string) string
- func GatewayForModel(compiled *CompiledCatalog, modelID string) string
- func GetModelDeprecationWarning(modelID, provider string) string
- func GetModelMarketingName(modelID string) string
- func IsBootstrapCatalog(c *Catalog) bool
- func IsLiveOnlyProvider(providerID string) bool
- func IsSetupGateway(providerID string) bool
- func LiveDiscoverableDeploymentIDs() []string
- func ModelForRoleV1(compiled *CompiledCatalog, roles ModelRoleAssignments, role ModelRole) string
- func ModelOwner(entry ModelCatalogEntry) string
- func MostExpensiveModelForProvider(compiled *CompiledCatalog, provider, fallback string) string
- func PreferredModelsForTier(compiled *CompiledCatalog, primaryProvider string, tier ModelTier, limit int) []string
- func PreferredProviderModel(compiled *CompiledCatalog, provider string, tier ModelTier, fallback string) string
- func PrimaryAPIKeyEnvForDeployment(compiled *CompiledCatalog, deploymentID string) string
- func PrimaryAPIKeyEnvForProvider(compiled *CompiledCatalog, providerID string) string
- func PrimaryModel(compiled *CompiledCatalog) string
- func ProviderDefaultModel(compiled *CompiledCatalog, provider, fallback string) string
- func ProviderDisplayName(providerID string) string
- func ProviderForModel(compiled *CompiledCatalog, modelName string) string
- func ProviderIDsFromCompiled(compiled *CompiledCatalog) []string
- func ResolvedRemoteCatalogURL(explicit string) string
- func SanitizePricing(c *Catalog)
- func SpecByEnvVar(env string) (registry.ProviderSpec, bool)
- func SpecByProviderID(id string) (registry.ProviderSpec, bool)
- func SplitOfferingID(id string) (deploymentID, nativeModelID string, ok bool)
- func ValidateCatalog(c *Catalog) error
- func WriteCatalogCache(cachePath string, c *Catalog) error
- type CapabilitySet
- type CapabilityState
- type Catalog
- type CatalogDiagnostic
- type CompiledCatalog
- func CompileCatalog(c *Catalog) (*CompiledCatalog, error)
- func CompileTestCatalog() (*CompiledCatalog, error)
- func LoadCatalog(ctx context.Context, opts LoadCatalogOptions) (*CompiledCatalog, error)
- func LoadCatalogForDiscovery(ctx context.Context) (*CompiledCatalog, error)
- func LoadValidCatalogCache(cachePath string) (*CompiledCatalog, bool)
- func (c *CompiledCatalog) CanonicalModelForAliasOrID(value string) (string, bool)
- func (c *CompiledCatalog) CapabilitiesForModel(modelID, deploymentID string) CapabilitySet
- func (c *CompiledCatalog) FirstModelForProvider(providerID string) (string, bool)
- func (c *CompiledCatalog) ModelIDsForProvider(providerID string) []string
- func (c *CompiledCatalog) OfferingForDeployment(canonicalModelID, deploymentID string) (ModelOffering, bool)
- func (c *CompiledCatalog) ProviderNames() []string
- type Credential
- type Credentials
- type Deployment
- type DeprecationEntry
- type EnvFallback
- type LiveProviderEnrichment
- type LoadCatalogOptions
- type Model
- type ModelCatalog
- type ModelCatalogEntry
- func FetchLiveModelEntriesForProvider(env map[string]string, providerID string) ([]ModelCatalogEntry, error)
- func FetchOllamaModels(env map[string]string) ([]ModelCatalogEntry, error)
- func LiveEntriesToCatalog(in []live.Entry) []ModelCatalogEntry
- func ModelEntriesForProvider(compiled *CompiledCatalog, provider string) []ModelCatalogEntry
- type ModelConfig
- type ModelCostTier
- type ModelKey
- type ModelName
- type ModelOffering
- type ModelOfferingTemplate
- type ModelRole
- type ModelRoleAssignments
- type ModelTier
- type NativeModelIDSource
- type Pricing
- type PricingStatus
- type Protocol
- type Provenance
- type Provider
- type RefreshResult
Constants ¶
const ( ClaudeOpusV4_6 = "claude-opus-4-6" ClaudeSonnetV4_6 = "claude-sonnet-4-6" ClaudeHaikuV4_5 = "claude-haiku-4-5-20251001" GPT_4o = "gpt-4o" GPT_4oMini = "gpt-4o-mini" Grokk_2 = "grok-2" Glm51 = "glm-5.1" )
ModelID constants for well-known models used across tests.
const ( CatalogSchemaVersion = "model-catalog/v1" // SeedCatalogURL is the published model-catalog/v1 document. SeedCatalogURL = "https://langdag.com/model-catalog/v1/catalog.json" EnvCatalogURL = "EYRIE_MODEL_CATALOG_URL" // LiveStaleDuration is how long a cache remains fresh after live provider APIs were merged. LiveStaleDuration = 24 * time.Hour )
Variables ¶
var DefaultDeploymentEnvFallbacks = func() map[string][]EnvFallback { result := make(map[string][]EnvFallback, len(registry.DeploymentEnvFallbacks())+len(extraDeploymentEnvFallbacks)) for id, fbs := range registry.DeploymentEnvFallbacks() { var converted []EnvFallback for _, fb := range fbs { converted = append(converted, EnvFallback{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.
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.
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.
var ModelTierAliases = []ModelTier{TierSonnet, TierHaiku, TierOpus}
ModelTierAliases lists all valid tier names.
Functions ¶
func APIKeyEnvsForProvider ¶ added in v0.1.1
func APIKeyEnvsForProvider(compiled *CompiledCatalog, providerID string) []string
APIKeyEnvsForProvider lists API key env var names for a provider from deployment env_fallbacks.
func AllModelProviders ¶ added in v0.1.4
func AllModelProviders(compiled *CompiledCatalog) []string
AllModelProviders lists canonical model owner providers in the catalog.
func AnthropicNameToCanonical ¶
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 CanonicalModelForProviderNative ¶ added in v0.1.1
func CanonicalModelForProviderNative(compiled *CompiledCatalog, 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
CanonicalProviderID normalizes legacy provider aliases (e.g. gemini -> google, cline-pass -> clinepass).
func CheapestModelForProvider ¶ added in v0.1.4
func CheapestModelForProvider(compiled *CompiledCatalog, provider, fallback string) string
CheapestModelForProvider returns the lowest known input-priced model for a provider.
func CredentialStatusForProvider ¶ added in v0.1.1
func CredentialStatusForProvider(compiled *CompiledCatalog, 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
DeploymentIDForLiveCatalogKey maps a live fetch catalog key to a deployment ID.
func DiscoveryEnvKeyNames ¶ added in v0.1.1
DiscoveryEnvKeyNames returns env var names used for credential discovery from the catalog.
func DiscoveryEnvKeysFromCatalog ¶ added in v0.1.1
func DiscoveryEnvKeysFromCatalog(compiled *CompiledCatalog) []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
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 *Catalog)
EnsureCredentialRegistryInCatalog merges registry providers/deployments into catalog v1.
func EnsureDeploymentEnvFallbacks ¶ added in v0.1.1
func EnsureDeploymentEnvFallbacks(c *Catalog)
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
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) (Catalog, []LiveProviderEnrichment)
FetchLiveProviderCatalog discovers models from all registered live provider APIs that have API keys available in env. Returns a catalog with enriched model listings and a list of per-provider fetch statuses.
func FirstModelForProvider ¶ added in v0.1.1
func FirstModelForProvider(compiled *CompiledCatalog, 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 *CompiledCatalog, modelID string) string
GatewayForModel returns the setup gateway that serves a model (e.g. openrouter for openrouter/auto).
func GetModelDeprecationWarning ¶
GetModelDeprecationWarning returns a deprecation warning or empty string.
func GetModelMarketingName ¶
GetModelMarketingName returns the marketing display name for a model ID.
func IsBootstrapCatalog ¶ added in v0.1.1
IsBootstrapCatalog reports whether c is the empty wiring-only catalog.
func IsLiveOnlyProvider ¶ added in v0.1.1
IsLiveOnlyProvider reports whether a provider uses live API discovery only. All providers are now fully dynamic.
func IsSetupGateway ¶ added in v0.1.1
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 IDs that have live model-list APIs.
func ModelForRoleV1 ¶ added in v0.1.3
func ModelForRoleV1(compiled *CompiledCatalog, 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 MostExpensiveModelForProvider ¶ added in v0.1.4
func MostExpensiveModelForProvider(compiled *CompiledCatalog, provider, fallback string) string
MostExpensiveModelForProvider returns the highest known input-priced model for a provider.
func PreferredModelsForTier ¶ added in v0.1.4
func PreferredModelsForTier(compiled *CompiledCatalog, primaryProvider string, tier ModelTier, limit int) []string
PreferredModelsForTier returns unique preferred models for a tier, starting with primaryProvider and then following the registry chat preference order.
func PreferredProviderModel ¶ added in v0.1.4
func PreferredProviderModel(compiled *CompiledCatalog, provider string, tier ModelTier, fallback string) string
PreferredProviderModel returns the preferred model for provider and tier.
func PrimaryAPIKeyEnvForDeployment ¶ added in v0.1.1
func PrimaryAPIKeyEnvForDeployment(compiled *CompiledCatalog, 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 *CompiledCatalog, providerID string) string
PrimaryAPIKeyEnvForProvider returns the preferred API key env var for a provider.
func PrimaryModel ¶ added in v0.1.4
func PrimaryModel(compiled *CompiledCatalog) string
PrimaryModel returns a stable best-effort model from chat-preferred providers.
func ProviderDefaultModel ¶ added in v0.1.4
func ProviderDefaultModel(compiled *CompiledCatalog, provider, fallback string) string
ProviderDefaultModel returns the provider's first catalog model.
func ProviderDisplayName ¶ added in v0.1.1
ProviderDisplayName returns UI label from registry.
func ProviderForModel ¶ added in v0.1.4
func ProviderForModel(compiled *CompiledCatalog, modelName string) string
ProviderForModel returns the canonical owner provider for modelName.
func ProviderIDsFromCompiled ¶ added in v0.1.1
func ProviderIDsFromCompiled(compiled *CompiledCatalog) []string
ProviderIDsFromCompiled lists provider IDs from catalog providers and deployments.
func ResolvedRemoteCatalogURL ¶ added in v0.1.1
func SanitizePricing ¶ added in v0.1.4
func SanitizePricing(c *Catalog)
SanitizePricing drops invalid rate dimensions (e.g. negative 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 SplitOfferingID ¶ added in v0.1.4
func ValidateCatalog ¶ added in v0.1.4
func WriteCatalogCache ¶ added in v0.1.4
Types ¶
type CapabilitySet ¶ added in v0.1.4
type CapabilitySet 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"`
}
func CapabilitySetFromEntry ¶ added in v0.1.4
func CapabilitySetFromEntry(e live.Entry) CapabilitySet
CapabilitySetFromEntry builds a CapabilitySet from a live entry's features.
type CapabilityState ¶ added in v0.1.1
type CapabilityState string
const ( CapabilitySupported CapabilityState = "supported" CapabilityUnsupported CapabilityState = "unsupported" CapabilityUnknown CapabilityState = "unknown" )
type Catalog ¶ added in v0.1.4
type Catalog struct {
SchemaVersion string `json:"schema_version"`
GeneratedAt time.Time `json:"generated_at"`
StaleAfter time.Time `json:"stale_after"`
Providers map[string]Provider `json:"providers"`
Protocols map[string]Protocol `json:"api_protocols"`
Deployments map[string]Deployment `json:"deployments"`
Models map[string]Model `json:"models"`
Offerings []ModelOffering `json:"offerings"`
OfferingTemplates []ModelOfferingTemplate `json:"offering_templates,omitempty"`
Aliases map[string]string `json:"aliases,omitempty"`
Provenance *Provenance `json:"provenance,omitempty"`
}
Catalog separates model ownership from the API protocol and deployment used to call the model. It is intentionally data-only; adapters remain code.
func BootstrapCatalog ¶ added in v0.1.4
func BootstrapCatalog() Catalog
BootstrapCatalog returns deployment/provider wiring only — no chat models. Chat models come from the published catalog cache and live provider discovery.
func FetchRemoteCatalog ¶ added in v0.1.4
func FetchRemoteCatalog(ctx context.Context, opts LoadCatalogOptions) (*Catalog, error)
func ParseCatalog ¶ added in v0.1.4
func SeedCatalog ¶ added in v0.1.4
func SeedCatalog() Catalog
SeedCatalog returns a catalog built from the embedded test fixtures.
type CatalogDiagnostic ¶ added in v0.1.4
type CompiledCatalog ¶ added in v0.1.4
type CompiledCatalog struct {
Catalog *Catalog
ProvidersByID map[string]Provider
ProtocolsByID map[string]Protocol
DeploymentsByID map[string]Deployment
ModelsByID map[string]Model
OfferingsByID map[string]ModelOffering
OfferingsByCanonicalModel map[string][]ModelOffering
OfferingsByDeployment map[string][]ModelOffering
TemplatesByCanonicalModel map[string][]ModelOfferingTemplate
Diagnostics []CatalogDiagnostic
}
func CompileCatalog ¶ added in v0.1.4
func CompileCatalog(c *Catalog) (*CompiledCatalog, error)
func CompileTestCatalog ¶ added in v0.1.1
func CompileTestCatalog() (*CompiledCatalog, error)
CompileTestCatalog builds a compiled catalog from the embedded test fixtures.
func LoadCatalog ¶ added in v0.1.4
func LoadCatalog(ctx context.Context, opts LoadCatalogOptions) (*CompiledCatalog, error)
func LoadCatalogForDiscovery ¶ added in v0.1.1
func LoadCatalogForDiscovery(ctx context.Context) (*CompiledCatalog, error)
LoadCatalogForDiscovery returns the cached catalog or bootstrap wiring (no network).
func LoadValidCatalogCache ¶ added in v0.1.1
func LoadValidCatalogCache(cachePath string) (*CompiledCatalog, bool)
func (*CompiledCatalog) CanonicalModelForAliasOrID ¶ added in v0.1.4
func (c *CompiledCatalog) CanonicalModelForAliasOrID(value string) (string, bool)
func (*CompiledCatalog) CapabilitiesForModel ¶ added in v0.1.4
func (c *CompiledCatalog) CapabilitiesForModel(modelID, deploymentID string) CapabilitySet
CapabilitiesForModel returns the capability set for a model on a deployment.
func (*CompiledCatalog) FirstModelForProvider ¶ added in v0.1.4
func (c *CompiledCatalog) FirstModelForProvider(providerID string) (string, bool)
func (*CompiledCatalog) ModelIDsForProvider ¶ added in v0.1.4
func (c *CompiledCatalog) ModelIDsForProvider(providerID string) []string
ModelIDsForProvider returns all model IDs for a given provider, sorted.
func (*CompiledCatalog) OfferingForDeployment ¶ added in v0.1.4
func (c *CompiledCatalog) OfferingForDeployment(canonicalModelID, deploymentID string) (ModelOffering, bool)
func (*CompiledCatalog) ProviderNames ¶ added in v0.1.4
func (c *CompiledCatalog) ProviderNames() []string
type Credential ¶ added in v0.1.4
type Credentials ¶ added in v0.1.1
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 Deployment ¶ added in v0.1.4
type Deployment 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 []Credential `json:"credential_requirements,omitempty"`
EnvFallbacks []EnvFallback `json:"env_fallbacks,omitempty"`
NativeModelIDSource NativeModelIDSource `json:"native_model_id_source"`
ModelMappingsRequired bool `json:"model_mappings_required,omitempty"`
Local bool `json:"local,omitempty"`
Provenance *Provenance `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 EnvFallback ¶ added in v0.1.4
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 LoadCatalogOptions ¶ added in v0.1.4
type Model ¶ added in v0.1.4
type Model 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 *Provenance `json:"provenance,omitempty"`
}
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.
func SeedModelCatalog ¶ added in v0.1.4
func SeedModelCatalog() ModelCatalog
SeedModelCatalog returns the embedded test model catalog.
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 *CompiledCatalog, 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 ¶
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 *CompiledCatalog, modelName string) ModelCostTier
ModelCostTierOf resolves a model's cost tier from catalog family and pricing data.
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 ModelOffering ¶ added in v0.1.4
type ModelOffering struct {
ID string `json:"id"`
CanonicalModelID string `json:"canonical_model_id"`
DeploymentID string `json:"deployment_id"`
NativeModelID string `json:"native_model_id"`
Capabilities CapabilitySet `json:"capabilities,omitempty"`
Pricing Pricing `json:"pricing"`
LiveMetadata json.RawMessage `json:"live_metadata,omitempty"`
Provenance *Provenance `json:"provenance,omitempty"`
}
type ModelOfferingTemplate ¶ added in v0.1.4
type ModelOfferingTemplate 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 CapabilitySet `json:"capabilities,omitempty"`
Pricing Pricing `json:"pricing"`
Provenance *Provenance `json:"provenance,omitempty"`
}
func DefaultOfferingTemplates ¶ added in v0.1.4
func DefaultOfferingTemplates(generatedAt time.Time) []ModelOfferingTemplate
DefaultOfferingTemplates returns offering templates for Azure deployments (model mappings required).
type ModelRole ¶ added in v0.1.3
type ModelRole string
ModelRole identifies the purpose of a model in a multi-model workflow.
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 *CompiledCatalog, 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 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 Pricing ¶ added in v0.1.4
type Pricing 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"`
}
func PricingFromEntry ¶ added in v0.1.4
PricingFromEntry builds a Pricing from a live entry's per-token rates.
type PricingStatus ¶ added in v0.1.1
type PricingStatus string
const ( PricingKnown PricingStatus = "known" PricingPartial PricingStatus = "partial" PricingUnknown PricingStatus = "unknown" PricingFree PricingStatus = "free" )
type Protocol ¶ added in v0.1.4
type Protocol struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Provenance *Provenance `json:"provenance,omitempty"`
}
type Provenance ¶ added in v0.1.4
type RefreshResult ¶ added in v0.1.1
type RefreshResult struct {
Compiled *CompiledCatalog
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 RefreshCatalog ¶ added in v0.1.4
func RefreshCatalog(ctx context.Context, opts LoadCatalogOptions) (*RefreshResult, error)
RefreshCatalog fetches the published catalog, validates it, and writes the cache. Unlike LoadCatalog 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.
Source Files
¶
- bootstrap.go
- compiled_list.go
- credential_registry.go
- credentials.go
- deployment_env.go
- deprecation.go
- discovery_load.go
- doc.go
- errors.go
- fetch.go
- gateway.go
- live_catalog.go
- live_enrich.go
- model_catalog.go
- model_owner.go
- model_policy.go
- model_tiers.go
- provider_credentials.go
- refresh.go
- testfixtures.go
- types.go
- v1.go
- v1_defaults.go
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. |