{"modulePath":"github.com/memcode-ai/memcode","version":"v0.7.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package catalog\n\n## Constants\n\n```go\nconst (\n\tModelOpus   = \"claude-opus-5\"             // anthropic frontier tier\n\tModelSonnet = \"claude-sonnet-5\"           // advisor default (second-opinion, cross-vendor); anthropic balanced tier\n\tModelHaiku  = \"claude-haiku-4-5-20251001\" // anthropic cheap tier\n)\n```\nCanonical Claude model IDs (current as of build). These back the ADVISOR (Sonnet) and per-vendor tier fallbacks; the default inference tiers use the GPT-5.6 ids below.\n\n```go\nconst (\n\tModelSol   = \"gpt-5.6-sol\"   // frontier — escalation target\n\tModelTerra = \"gpt-5.6-terra\" // balanced — everyday default + fallback absorb\n\tModelLuna  = \"gpt-5.6-luna\"  // fast/cheap — classifier + reviewer\n)\n```\nGPT-5.6 model IDs — the default inference tiers (OpenAI Responses API). Sol is the frontier escalation target, Terra the balanced everyday default + fallback absorb target, Luna the fast/cheap classifier.\n\n```go\nconst (\n\tModelGeminiPro       = \"gemini-3.1-pro-preview\" // frontier — escalation target\n\tModelGeminiFlash     = \"gemini-3.6-flash\"       // balanced — everyday default + fallback absorb\n\tModelGeminiFlashLite = \"gemini-3.5-flash-lite\"  // fast/cheap — classifier\n)\n```\nGemini 3 model IDs (Google, via the native genai SDK).\n\n```go\nconst (\n\tModelGrok45 = \"grok-4.5\" // single model — serves frontier/balanced/cheap tiers\n)\n```\nGrok model ID (xAI, via the OpenAI-compatible api.x.ai endpoint). Grok 4.5 is the single model for all three strong-tier roles, so the selector resolves every tier to this id.\n\n## Functions\n\n```go\nfunc ContextWindow(model string) int\n```\nContextWindow returns the input context-window size (tokens) for a model id or label: the catalog entry if it declares one, else the first matching family rule, else the default. Used by the footer's \"ctx N%\" meter and the overflow ceiling when a backend doesn't report its window on the wire.\n\n```go\nfunc CostUSD(model string, inTok, outTok, cacheRead, cacheWrite int) float64\n```\nCostUSD prices one response's token usage under its model's rate card.\n\n```go\nfunc FallbackChain(idOrLabel string) []string\n```\nFallbackChain returns the mid-turn failure chain (labels) for a model id or label. Nil when the catalog declares none.\n\n```go\nfunc MaxOutputTokens(model string) int\n```\nMaxOutputTokens returns the model's max output tokens from the catalog, or 0 when the catalog doesn't declare one. Callers that must send a max\\_tokens value on the wire (Anthropic requires the field) use this to translate \"uncapped\" (request MaxTokens 0) into the largest value the model accepts.\n\n```go\nfunc ModelVendor(idOrLabel string) string\n```\nModelVendor returns the authoritative serving vendor for a model id or label (\"openai\" | \"anthropic\" | \"gemini\" | \"grok\" | \"fireworks\"), \"\" when unknown.\n\n```go\nfunc SearchFeeUSD(vendor string, searches int) float64\n```\nSearchFeeUSD prices the PER-REQUEST native web-search surcharge for a call: the serving vendor's catalog fee (models.json search\\_fees, USD per 1,000 searches) times the number of searches the vendor billed (Response.SearchCount). Tokens alone under-billed searched turns — the upstream per-request fee never entered cost\\_usd. A vendor without a search\\_fees entry (gemini, the cheap lane, unknown backends) returns 0.\n\n```go\nfunc TierAltitude(label string) string\n```\nTierAltitude names the tier (\"frontier\" | \"balanced\" | \"cheap\") a label occupies within its OWNING vendor's triple, \"\" for models outside the triple (pin-only models). The catalog-data replacement for the old altitudeOf.\n\n```go\nfunc TierVendors() []string\n```\nTierVendors returns the vendors the catalog declares a strong-tier triple for, in a stable order (models.json is data — this is derived, not coded).\n\n```go\nfunc VendorTier(vendor, tier string) string\n```\nVendorTier returns the LABEL of the model playing a tier (\"frontier\" | \"balanced\" | \"cheap\") for a vendor, from the catalog's tiers table. \"\" when the vendor or tier isn't declared.\n\n## Types\n\n```go\ntype CatalogModel struct {\n\tID             string  `json:\"id\"`\n\tLabel          string  `json:\"label\"`          // client-facing short name — the only id the CLI sees\n\tVendor         string  `json:\"vendor\"`         // authoritative serving vendor (\"openai\" | \"anthropic\" | \"gemini\" | \"grok\" | \"fireworks\") — selection/steering identity, distinct from the display Group\n\tName           string  `json:\"name,omitempty\"` // friendly display name (\"Sonnet 5\", \"Grok 4.5\") — the /model picker's name column\n\tDesc           string  `json:\"desc,omitempty\"` // one-line picker description (\"1M context · Efficient for routine tasks\")\n\tWindow         int     `json:\"window\"`\n\tMaxOutput      int     `json:\"max_output,omitempty\"` // model's max output tokens; consumed where the provider REQUIRES max_tokens (Anthropic) to mean \"uncapped\"\n\tVision         bool    `json:\"vision\"`\n\tPDF            bool    `json:\"pdf,omitempty\"` // accepts PDFs natively on the LLM call (document block / input_file / inline blob)\n\tReasoning      bool    `json:\"reasoning\"`\n\tPinnable       bool    `json:\"pinnable,omitempty\"` // offered in the /model picker\n\tGroup          string  `json:\"group,omitempty\"`    // picker display family (\"OpenAI\", \"Kimi\", …)\n\tPriceIn        float64 `json:\"price_in,omitempty\"` // $/M tokens\n\tPriceOut       float64 `json:\"price_out,omitempty\"`\n\tPriceCacheRead float64 `json:\"price_cache_read,omitempty\"` // optional override (default in×0.1)\n\n\t// Fallback is the model's mid-turn failure chain, in LABELS: who covers\n\t// when this model errors after transport retries, walked IN ORDER by the\n\t// CLI's recovery executor (availability/billing filtering happens at walk\n\t// time, client-side). Data, not Go — the routing doctrine lives here.\n\tFallback []string `json:\"fallback,omitempty\"`\n}\n```\nCatalogModel is one models.json entry: a model's identity and its static facts. A zero Window or zero pricing means \"not declared here\" — lookups fall through to the family rules, then the defaults.\n\n```go\nfunc CatalogModels() []CatalogModel\n```\nCatalogModels returns every models.json entry in file order (the display order).\n\n```go\nfunc LookupModel(idOrLabel string) (CatalogModel, bool)\n```\nLookupModel resolves a raw id or a client-facing label to its catalog entry.\n\n```go\ntype Pricing struct{ Input, Output, CacheWrite, CacheRead float64 }\n```\nPricing is APPROXIMATE per-model rates in USD per MILLION tokens. Cache write ≈ 1.25× base input; cache read ≈ 0.1× base input unless the catalog overrides it.\n\n```go\nfunc ModelPricing(model string) Pricing\n```\nModelPricing returns the rate card for a model id or label: the catalog entry if it declares one, else the first matching family rule, else the default. Both ledgers price against this (the CLI's and the gateway's), so every id that can serve must resolve to a non-zero card — the family floor guarantees Fireworks-served ids are never $0.\n\n","path":"github.com/memcode-ai/memcode/internal/catalog","name":"catalog","synopsis":"","isRedistributable":true}
