catalog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOpenRouterBaseURL = "https://openrouter.ai/api/v1"
	DefaultCanopyWaveBaseURL = "https://inference.canopywave.io/v1"
)

Variables

View Source
var (
	Hawk37SonnetConfig = ModelConfig{
		"anthropic": "claude-3-7-sonnet-20250219", "openai": "gpt-4o-mini", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o-mini", "grok": "grok-2", "gemini": "gemini-2.0-flash",
		"ollama": "llama3.1:8b", "opencodego": "kimi-k2.5",
	}
	Hawk35V2SonnetConfig = ModelConfig{
		"anthropic": "claude-3-5-sonnet-20241022", "openai": "gpt-4o-mini", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o-mini", "grok": "grok-2", "gemini": "gemini-2.0-flash",
		"ollama": "llama3.1:8b", "opencodego": "kimi-k2.5",
	}
	Hawk35HaikuConfig = ModelConfig{
		"anthropic": "claude-3-5-haiku-20241022", "openai": "gpt-4o-mini", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o-mini", "grok": "grok-2", "gemini": "gemini-2.0-flash-lite",
		"ollama": "llama3.2:3b", "opencodego": "kimi-k2.5",
	}
	HawkHaiku45Config = ModelConfig{
		"anthropic": "claude-haiku-4-5-20251001", "openai": "gpt-4o-mini", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o-mini", "grok": "grok-2", "gemini": "gemini-2.0-flash-lite",
		"ollama": "llama3.2:3b", "opencodego": "kimi-k2.5",
	}
	HawkSonnet4Config = ModelConfig{
		"anthropic": "claude-sonnet-4-20250514", "openai": "gpt-4o-mini", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o-mini", "grok": "grok-2", "gemini": "gemini-2.0-flash",
		"ollama": "llama3.1:8b", "opencodego": "kimi-k2.5",
	}
	HawkSonnet45Config = ModelConfig{
		"anthropic": "claude-sonnet-4-5-20250929", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.0-flash",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
	HawkSonnet46Config = ModelConfig{
		"anthropic": "claude-sonnet-4-6", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.0-flash",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
	HawkOpus4Config = ModelConfig{
		"anthropic": "claude-opus-4-20250514", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.5-pro-preview-03-25",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
	HawkOpus41Config = ModelConfig{
		"anthropic": "claude-opus-4-1-20250805", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.5-pro-preview-03-25",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
	HawkOpus45Config = ModelConfig{
		"anthropic": "claude-opus-4-5-20251101", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.5-pro-preview-03-25",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
	HawkOpus46Config = ModelConfig{
		"anthropic": "claude-opus-4-6", "openai": "gpt-4o", "canopywave": "zai/glm-4.6",
		"openrouter": "openai/gpt-4o", "grok": "grok-2", "gemini": "gemini-2.5-pro-preview-03-25",
		"ollama": "llama3.1:70b", "opencodego": "kimi-k2.5",
	}
)

Individual model configs (tier × version → model ID per provider).

View Source
var AllModelConfigs = map[ModelKey]ModelConfig{
	"haiku35":  Hawk35HaikuConfig,
	"haiku45":  HawkHaiku45Config,
	"sonnet35": Hawk35V2SonnetConfig,
	"sonnet37": Hawk37SonnetConfig,
	"sonnet40": HawkSonnet4Config,
	"sonnet45": HawkSonnet45Config,
	"sonnet46": HawkSonnet46Config,
	"opus40":   HawkOpus4Config,
	"opus41":   HawkOpus41Config,
	"opus45":   HawkOpus45Config,
	"opus46":   HawkOpus46Config,
}

AllModelConfigs maps ModelKey to its config.

View Source
var AnthropicModels = []ModelCatalogEntry{
	{ID: "claude-opus-4-6", InputPricePer1M: 15, OutputPricePer1M: 75, ContextWindow: 200000, MaxOutput: 32000, ServerTools: []string{"web_search"}},
	{ID: "claude-sonnet-4-6", InputPricePer1M: 3, OutputPricePer1M: 15, ContextWindow: 200000, MaxOutput: 32000, ServerTools: []string{"web_search"}},
	{ID: "claude-haiku-4-5-20251001", InputPricePer1M: 1, OutputPricePer1M: 5, ContextWindow: 200000, MaxOutput: 16000, ServerTools: []string{"web_search"}},
}
View Source
var CanopyWaveModels = []ModelCatalogEntry{
	{ID: "zai/glm-4.6", InputPricePer1M: 0, OutputPricePer1M: 0, ContextWindow: 128000, MaxOutput: 8192},
}
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 GeminiModelDefaults = map[ModelTier]string{
	TierOpus: "gemini-2.5-pro-preview-03-25", TierSonnet: "gemini-2.0-flash", TierHaiku: "gemini-2.0-flash-lite",
}
View Source
var GeminiModels = []ModelCatalogEntry{
	{ID: "gemini-2.5-pro-preview-03-25", InputPricePer1M: 1.25, OutputPricePer1M: 5, ContextWindow: 1000000, MaxOutput: 65536, ServerTools: []string{"web_search"}},
	{ID: "gemini-2.0-flash", InputPricePer1M: 0.1, OutputPricePer1M: 0.4, ContextWindow: 1000000, MaxOutput: 8192, ServerTools: []string{"web_search"}},
	{ID: "gemini-2.0-flash-lite", InputPricePer1M: 0.075, OutputPricePer1M: 0.3, ContextWindow: 1000000, MaxOutput: 8192, ServerTools: []string{"web_search"}},
}
View Source
var GrokModels = []ModelCatalogEntry{
	{ID: "grok-2", InputPricePer1M: 2, OutputPricePer1M: 10, ContextWindow: 128000, MaxOutput: 8000, ServerTools: []string{"web_search"}},
}
View Source
var ModelTierAliases = []ModelTier{TierSonnet, TierHaiku, TierOpus}

ModelTierAliases lists all valid tier names.

View Source
var OllamaModels = []ModelCatalogEntry{}
View Source
var OpenAIModelDefaults = map[ModelTier]string{
	TierOpus: "gpt-4o", TierSonnet: "gpt-4o-mini", TierHaiku: "gpt-4o-mini",
}

Per-provider model defaults for OpenAI-compatible tiers.

View Source
var OpenAIModels = []ModelCatalogEntry{
	{ID: "gpt-4o", InputPricePer1M: 5, OutputPricePer1M: 15, ContextWindow: 128000, MaxOutput: 16000, ServerTools: []string{"web_search"}},
	{ID: "gpt-4o-mini", InputPricePer1M: 0.15, OutputPricePer1M: 0.6, ContextWindow: 128000, MaxOutput: 16000, ServerTools: []string{"web_search"}},
}
View Source
var OpenCodeGoModels = []ModelCatalogEntry{
	{ID: "glm-5.1", InputPricePer1M: 5, OutputPricePer1M: 15, ContextWindow: 128000, MaxOutput: 8000, DisplayName: "GLM-5.1", Description: "Zhipu GLM-5.1 · Advanced reasoning model"},
	{ID: "glm-5", InputPricePer1M: 5, OutputPricePer1M: 15, ContextWindow: 128000, MaxOutput: 8000, DisplayName: "GLM-5", Description: "Zhipu GLM-5 · Powerful general-purpose model"},
	{ID: "kimi-k2.5", InputPricePer1M: 3, OutputPricePer1M: 10, ContextWindow: 256000, MaxOutput: 8000, DisplayName: "Kimi K2.5", Description: "Moonshot Kimi K2.5 · Long-context specialist"},
	{ID: "kimi-k2.6", InputPricePer1M: 3, OutputPricePer1M: 10, ContextWindow: 256000, MaxOutput: 8000, DisplayName: "Kimi K2.6", Description: "Moonshot Kimi K2.6 · Enhanced long-context model"},
	{ID: "mimo-v2-pro", InputPricePer1M: 3, OutputPricePer1M: 10, ContextWindow: 128000, MaxOutput: 8000, DisplayName: "MiMo V2 Pro", Description: "MiMo V2 Pro · Professional-grade model"},
	{ID: "mimo-v2-omni", InputPricePer1M: 2, OutputPricePer1M: 8, ContextWindow: 128000, MaxOutput: 8000, DisplayName: "MiMo V2 Omni", Description: "MiMo V2 Omni · Versatile multimodal model"},
	{ID: "minimax-m2.7", InputPricePer1M: 1, OutputPricePer1M: 3, ContextWindow: 1000000, MaxOutput: 8000, DisplayName: "MiniMax M2.7", Description: "MiniMax M2.7 · Latest generation with 1M context"},
	{ID: "minimax-m2.5", InputPricePer1M: 0.5, OutputPricePer1M: 1.5, ContextWindow: 1000000, MaxOutput: 8000, DisplayName: "MiniMax M2.5", Description: "MiniMax M2.5 · Cost-effective with 1M context"},
	{ID: "qwen3.6-plus", InputPricePer1M: 0.3, OutputPricePer1M: 1.7, ContextWindow: 1000000, MaxOutput: 65536, DisplayName: "Qwen3.6 Plus", Description: "Alibaba Qwen3.6 Plus · Latest Qwen with 1M context"},
	{ID: "qwen3.5-plus", InputPricePer1M: 0.26, OutputPricePer1M: 1.56, ContextWindow: 1000000, MaxOutput: 65536, DisplayName: "Qwen3.5 Plus", Description: "Alibaba Qwen3.5 Plus · Strong coding capabilities"},
}
View Source
var OpenRouterModels = []ModelCatalogEntry{
	{ID: "openai/gpt-4o", InputPricePer1M: 5, OutputPricePer1M: 15, ContextWindow: 128000, MaxOutput: 16000, ServerTools: []string{"web_search"}},
	{ID: "openai/gpt-4o-mini", InputPricePer1M: 0.15, OutputPricePer1M: 0.6, ContextWindow: 128000, MaxOutput: 16000, ServerTools: []string{"web_search"}},
	{ID: "anthropic/claude-sonnet-4-6", InputPricePer1M: 3, OutputPricePer1M: 15, ContextWindow: 200000, MaxOutput: 32000, ServerTools: []string{"web_search"}},
}

Functions

func AnthropicNameToCanonical

func AnthropicNameToCanonical(name string) string

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

func CanonicalIDToKey

func CanonicalIDToKey() map[string]ModelKey

CanonicalIDToKey maps canonical Anthropic model ID → ModelKey.

func CanonicalModelIDs

func CanonicalModelIDs() []string

CanonicalModelIDs returns all canonical Anthropic model IDs.

func DefaultProviderCatalogs

func DefaultProviderCatalogs() map[string][]ModelCatalogEntry

DefaultProviderCatalogs returns the embedded catalog data for all providers.

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.

Types

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 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 DefaultModelCatalog

func DefaultModelCatalog() ModelCatalog

DefaultModelCatalog returns the embedded default catalog.

func FetchModelCatalog

func FetchModelCatalog(cachePath string, env map[string]string) (ModelCatalog, error)

FetchModelCatalog fetches catalog from remote APIs (OpenRouter, CanopyWave) and merges with embedded data. Writes result to cachePath if provided.

func LoadModelCatalogSync

func LoadModelCatalogSync(cachePath string) ModelCatalog

LoadModelCatalogSync loads a catalog from a cache file, falling back to embedded.

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

ModelCatalogEntry represents a single model in the catalog.

func ModelsForProvider

func ModelsForProvider(catalog *ModelCatalog, provider string) []ModelCatalogEntry

ModelsForProvider returns catalog entries for a given provider.

type ModelConfig

type ModelConfig map[string]ModelName

ModelConfig maps each APIProvider to a model name.

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, tier ModelTier, catalog *ModelCatalog) ModelName

GetPreferredProviderModel returns the preferred model for a provider/tier.

func GetProviderDefaultModel

func GetProviderDefaultModel(provider string, catalog *ModelCatalog) ModelName

GetProviderDefaultModel returns the default model for a provider.

func GetProviderModelCandidates

func GetProviderModelCandidates(provider string, tier ModelTier) []ModelName

GetProviderModelCandidates returns ordered candidate model IDs for a provider/tier.

type ModelTier

type ModelTier string

ModelTier represents opus/sonnet/haiku tiers.

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

Jump to

Keyboard shortcuts

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