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 *CompiledCatalogV1, providerID string) []string
- func AllModelProvidersV1(compiled *CompiledCatalogV1) []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 *CompiledCatalogV1, providerID, modelID string) (string, bool)
- func CanonicalProviderID(providerID string) string
- func CheapestModelForProviderV1(compiled *CompiledCatalogV1, provider, fallback string) string
- func CredentialStatusForProvider(compiled *CompiledCatalogV1, providerID string) string
- func DefaultCachePath() string
- func DeploymentIDForLiveCatalogKey(catalogKey string) string
- func DiscoveryEnvKeyNames(ctx context.Context) []string
- func DiscoveryEnvKeysFromCatalog(compiled *CompiledCatalogV1) []string
- func DisplayModelLabel(id, displayName string) string
- func DisplayModelOwner(owner, id string, liveMetadata ...json.RawMessage) string
- func EnsureCredentialRegistryInCatalog(c *CatalogV1)
- func EnsureDeploymentEnvFallbacks(c *CatalogV1)
- func EnvVarsForDeployment(deploymentID string) []string
- func FetchLiveProviderCatalog(env map[string]string) (ModelCatalog, []LiveProviderEnrichment)
- func FirstModelForProvider(compiled *CompiledCatalogV1, providerID string) string
- func GatewayForModel(compiled *CompiledCatalogV1, modelID string) string
- func GetModelDeprecationWarning(modelID, provider string) string
- func GetModelMarketingName(modelID string) string
- func IsBootstrapCatalog(c *CatalogV1) bool
- func IsLiveOnlyProvider(providerID string) bool
- func IsSetupGateway(providerID string) bool
- func LiveDiscoverableDeploymentIDs() []string
- func ModelForRoleV1(compiled *CompiledCatalogV1, roles ModelRoleAssignments, role ModelRole) string
- func ModelOwner(entry ModelCatalogEntry) string
- func MostExpensiveModelForProviderV1(compiled *CompiledCatalogV1, provider, fallback string) string
- func PreferredModelsForTierV1(compiled *CompiledCatalogV1, primaryProvider string, tier ModelTier, limit int) []string
- func PreferredProviderModelV1(compiled *CompiledCatalogV1, provider string, tier ModelTier, fallback string) string
- func PrimaryAPIKeyEnvForDeployment(compiled *CompiledCatalogV1, deploymentID string) string
- func PrimaryAPIKeyEnvForProvider(compiled *CompiledCatalogV1, providerID string) string
- func PrimaryModelV1(compiled *CompiledCatalogV1) string
- func ProviderDefaultModelV1(compiled *CompiledCatalogV1, provider, fallback string) string
- func ProviderDisplayName(providerID string) string
- func ProviderForModelV1(compiled *CompiledCatalogV1, modelName string) string
- func ProviderIDsFromCompiled(compiled *CompiledCatalogV1) []string
- func ResolvedRemoteCatalogURL(explicit string) string
- func SanitizeCatalogV1Pricing(c *CatalogV1)
- func SpecByEnvVar(env string) (registry.ProviderSpec, bool)
- func SpecByProviderID(id string) (registry.ProviderSpec, bool)
- func SplitOfferingIDV1(id string) (deploymentID, nativeModelID string, ok bool)
- func ValidateCatalogV1(c *CatalogV1) error
- func WriteCatalogV1Cache(cachePath string, c *CatalogV1) error
- type APIProtocolV1
- type CapabilitySetV1
- type CapabilityState
- type CatalogDiagnosticV1
- type CatalogProvenanceV1
- type CatalogV1
- func BootstrapCatalogV1() CatalogV1
- func CatalogV1FromLegacy(legacy ModelCatalog) CatalogV1
- func DefaultCatalogV1() CatalogV1
- func FetchRemoteCatalogV1(ctx context.Context, opts LoadCatalogV1Options) (*CatalogV1, error)
- func ParseCatalogV1(data []byte) (*CatalogV1, error)
- func TestSeedCatalogV1() CatalogV1
- type CompiledCatalogV1
- func CompileCatalogV1(c *CatalogV1) (*CompiledCatalogV1, error)
- func CompileTestCatalog() (*CompiledCatalogV1, error)
- func LoadCatalogForDiscovery(ctx context.Context) (*CompiledCatalogV1, error)
- func LoadCatalogV1(ctx context.Context, opts LoadCatalogV1Options) (*CompiledCatalogV1, error)
- func LoadValidCatalogCache(cachePath string) (*CompiledCatalogV1, bool)
- type CredentialV1
- type Credentials
- type DeploymentV1
- type DeprecationEntry
- type EnvFallbackV1
- type LiveProviderEnrichment
- type LoadCatalogV1Options
- 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 *CompiledCatalogV1, provider string) []ModelCatalogEntry
- type ModelConfig
- type ModelCostTier
- type ModelKey
- type ModelName
- type ModelOfferingTemplateV1
- type ModelOfferingV1
- type ModelRole
- type ModelRoleAssignments
- type ModelTier
- type ModelV1
- type NativeModelIDSource
- type PricingStatus
- type PricingV1
- type ProviderV1
- type RefreshResult
Constants ¶
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" )
const LiveCatalogStaleDuration = 24 * time.Hour
LiveCatalogStaleDuration is how long a cache remains fresh after live provider APIs were merged.
Variables ¶
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.
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 *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 ¶
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 *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
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
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 *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
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
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 ¶
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 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
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
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 ValidateCatalogV1 ¶ added in v0.1.1
func WriteCatalogV1Cache ¶ added in v0.1.1
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 CatalogProvenanceV1 ¶ added in v0.1.1
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 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 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 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 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 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 ¶
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 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.
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 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 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.
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. |