{"modulePath":"github.com/memcode-ai/memcode","version":"v0.56.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package catalog\n\n## Constants\n\n```go\nconst (\n\tModelOpus   = \"claude-opus-5-5\"   // anthropic frontier tier\n\tModelSonnet = \"claude-sonnet-5-5\" // advisor default (second-opinion, cross-vendor); anthropic balanced tier\n\tModelHaiku  = \"claude-haiku-5-5\"  // 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-6 ids below.\n\n```go\nconst (\n\tModelSol   = \"gpt-6.2-sol\"   // strong — escalation target\n\tModelTerra = \"gpt-6.1-terra\" // balanced — everyday default + fallback absorb\n\tModelLuna  = \"gpt-6-luna\"    // fast/cheap — classifier + reviewer\n)\n```\nGPT-6 model IDs — the OpenAI tiers (Responses API). Sol is the strong escalation target, Terra the balanced everyday default + fallback absorb target, Luna the fast/cheap classifier. Astra, the frontier tier, is pinned by label only.\n\n```go\nconst (\n\tModelGeminiPro       = \"gemini-4-carbon\"       // frontier — escalation target\n\tModelGeminiFlash     = \"gemini-4-hydrogen\"     // the Gemini vendor's everyday model\n\tModelGeminiFlashLite = \"gemini-3.5-flash-lite\" // fast/cheap — classifier\n)\n```\nGemini model IDs (Google, via the native genai SDK).\n\n```go\nconst (\n\tModelGrok47 = \"grok-4.7\" // single model — serves frontier/balanced/cheap tiers\n)\n```\nGrok model ID (xAI, via the OpenAI-compatible api.x.ai endpoint). Grok 4.7 is the single model for all three strong-tier roles, so the selector resolves every tier to this id.\n\n## Variables\n\n```go\nvar EffortScale = []string{\"low\", \"medium\", \"high\", \"xhigh\", \"max\"}\n```\nEffortScale is memcode's universal reasoning-effort scale, lowest first. Two values sit outside it: \"\" (off: no extended thinking, used by helper calls) and \"default\" (send no effort; the vendor's own default applies).\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. Token counts here are cache-EXCLUSIVE (see compat.applyUsage), so the prompt that decides the tier is the sum of all three input components.\n\n```go\nfunc DefaultModel() string\n```\nDefaultModel returns the seed label for an install with no pin anywhere. Its ONLY legitimate caller is the pin resolver, and only when the session/workspace/user chain came up empty; the result is persisted so the next run reads a concrete pin instead of re-deriving this.\n\n```go\nfunc DropsUnboundThinking(model string) bool\n```\nDropsUnboundThinking reports whether the adapter must send block\\_binding drop\\_block so an edited history drops stale thinking blocks instead of 400ing.\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 MinReasoningEffort(model string) string\n```\nMinReasoningEffort returns the lowest reasoning effort a model accepts, or \"\" when the catalog declares no floor. Adapters clamp against it so a cheap classifier turn can't 400 on a model whose range starts above \"none\".\n\n```go\nfunc ModelEfforts(model string) []string\n```\nModelEfforts returns the scale levels a model supports natively, lowest first, or nil when the catalog declares none.\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 RejectsForcedToolChoice(model string) bool\n```\nRejectsForcedToolChoice reports whether a model 400s on a forced tool\\_choice, so the adapter must fall back to auto plus an explicit instruction.\n\n```go\nfunc ResolveEffort(model, level string) string\n```\nResolveEffort maps a universal effort level onto the closest level the model supports natively. On a tie it takes the higher level, the same direction the vendors collapse unsupported levels (Fireworks runs GLM's low and medium as high). \"\" (off), \"default\", unknown levels, and models with no declared levels pass through unchanged. Equal labels on different vendors are not equal reasoning budgets; this only picks the nearest native setting.\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 SubscriptionUtilityModel(vendor string) string\n```\nSubscriptionUtilityModel returns the utility label for plumbing when the session runs on a subscription of vendor, \"\" when the catalog declares none (callers then use UtilityModel).\n\n```go\nfunc UsesThinkingLevels(model string) bool\n```\nUsesThinkingLevels reports whether a Gemini model wants thinkingLevel rather than a thinkingBudget.\n\n```go\nfunc UtilityModel() string\n```\nUtilityModel returns the label for internal plumbing (classify/authorize, compact, shrinkwrap). Never user-facing, never in the picker, never a substitute for the pinned model.\n\n```go\nfunc VendorUtilityModel(vendor string) string\n```\nVendorUtilityModel returns the label of vendor's small helper model, or \"\" when the vendor has none (callers then use UtilityModel).\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 (standing rate)\n\tPriceOut       float64       `json:\"price_out,omitempty\"`\n\tPriceCacheRead float64       `json:\"price_cache_read,omitempty\"` // optional override (default in×0.1)\n\tPromoPricing   *PromoPricing `json:\"promo_pricing,omitempty\"`    // optional date-bounded promotional rate card\n\n\t// PriceTiers bends the rate card by PROMPT SIZE. Several vendors now price a\n\t// long prompt differently from a short one (GPT-6 Astra doubles input and\n\t// adds half again to output past 272K), and that is a per-request fact, not a\n\t// per-model one. Expressing it as ordered multiplier data — rather than a\n\t// special case in Go — keeps the rule where every consumer already reads it:\n\t// this file is shared verbatim with the gateway and with apps/www's own\n\t// calculateCost, and only one of those three can run Go.\n\tPriceTiers []PriceTier `json:\"price_tiers,omitempty\"`\n\n\t// MinReasoningEffort is the LOWEST reasoning effort this model accepts, in the\n\t// vendor's own vocabulary. Vendors disagree about the bottom of the range —\n\t// GPT-5.6 takes \"none\", GPT-6 Astra's floor is \"low\" and 400s below it — and\n\t// that is a model fact, so it lives here rather than as another adapter bool.\n\t// Empty means \"no floor\": send whatever the effort maps to.\n\tMinReasoningEffort string `json:\"min_reasoning_effort,omitempty\"`\n\n\t// Efforts lists the levels of memcode's universal effort scale (low, medium,\n\t// high, xhigh, max) this model supports natively, lowest first, from the\n\t// vendor's own docs. ResolveEffort maps any other level onto the closest of\n\t// these. Empty means the catalog declares none and levels pass through.\n\tEfforts []string `json:\"efforts,omitempty\"`\n\n\t// NoForcedToolChoice marks a model that rejects a forced tool_choice\n\t// ({type:\"tool\"} or {type:\"any\"}) with a 400. Claude Fable 5.1 and Opus 5.5\n\t// do; the structured-output callers (judges, reflection, review verdicts)\n\t// still need their tool called, so the adapter asks for it in words under\n\t// tool_choice auto instead. A model fact, so it lives here.\n\tNoForcedToolChoice bool `json:\"no_forced_tool_choice,omitempty\"`\n\n\t// DropUnboundThinking marks a model that enforces the preserved-thinking\n\t// history check on EVERY account: a replayed thinking block whose system,\n\t// tools or earlier messages changed since it was produced is a 400. The\n\t// volatile system block changes every turn, so the adapter sends\n\t// block_binding drop_block on these models and the API drops the stale\n\t// blocks instead. Only Fable 5.2 today; models that enforce new accounts\n\t// only keep reading the blocks on memcode's account, so dropping there would\n\t// lose reasoning for nothing.\n\tDropUnboundThinking bool `json:\"drop_unbound_thinking,omitempty\"`\n\n\t// ThinkingLevels marks a Gemini model that takes thinkingLevel (LOW, MEDIUM,\n\t// HIGH) and 400s on thinkingBudget. Gemini 4 is level-only and has no off,\n\t// so the adapter maps EffortOff to LOW there.\n\tThinkingLevels bool `json:\"thinking_levels,omitempty\"`\n\n\t// Aliases are RETIRED labels and ids that must keep resolving to this entry.\n\t// When a vendor decommissions a model, deleting its row would make every pin\n\t// naming it a hard \"unknown model\" 400 at the gateway; listing the dead name\n\t// here migrates those pins onto the replacement instead, which is exactly\n\t// what the vendor's own migration does. A real label always wins over an\n\t// alias, so an alias can never shadow a live model.\n\tAliases []string `json:\"aliases,omitempty\"`\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 PriceTier struct {\n\tAbovePromptTokens int     `json:\"above_prompt_tokens\"`\n\tIn                float64 `json:\"in,omitempty\"`\n\tOut               float64 `json:\"out,omitempty\"`\n\tCacheRead         float64 `json:\"cache_read,omitempty\"`\n\tCacheWrite        float64 `json:\"cache_write,omitempty\"`\n}\n```\nPriceTier is one prompt-size pricing band: once a request's prompt exceeds AbovePromptTokens, every rate on the card is multiplied for the WHOLE request (not just the tokens past the line — that is how vendors actually bill it).\n\nA multiplier left at 0 means 1× (unchanged), so a tier states only what it bends. Tiers are independent: the highest threshold a prompt clears wins, so order in JSON doesn't matter and a vendor can declare as many bands as it likes.\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 LookupModelPricing(model string) (Pricing, bool)\n```\nLookupModelPricing returns a model's base rate card when the model has known pricing in the catalog (an explicit entry or a matching family rule), and ok=false when the model is unknown and would only fall back to Defaults.\n\n```go\nfunc LookupModelPricingOn(model, date string) (Pricing, bool)\n```\nLookupModelPricingOn is LookupModelPricing evaluated at an explicit UTC date (YYYY-MM-DD), honoring any active promotional window on that date.\n\n```go\nfunc ModelPricing(model string) Pricing\n```\nModelPricing returns a model's BASE rate card — the short-prompt rates, before any prompt-size tier applies. Estimates and rate displays want this; anything billing a real request must use ModelPricingAt so a long prompt prices right.\n\n```go\nfunc ModelPricingAt(model string, promptTokens int) Pricing\n```\nModelPricingAt returns the rate card that actually governs a request whose prompt is promptTokens long — base card with the winning tier's multipliers folded in. promptTokens is the WHOLE prompt: fresh input plus cache reads plus cache writes, since vendors measure the threshold against everything they read.\n\n```go\nfunc ModelPricingOn(model, date string) Pricing\n```\nModelPricingOn returns a model's base rate card on a specific UTC date (YYYY-MM-DD).\n\n```go\ntype PromoPricing struct {\n\tFrom           string  `json:\"from,omitempty\"` // optional inclusive YYYY-MM-DD start date (UTC)\n\tUntil          string  `json:\"until\"`          // inclusive YYYY-MM-DD end date (UTC)\n\tPriceIn        float64 `json:\"price_in\"`\n\tPriceOut       float64 `json:\"price_out\"`\n\tPriceCacheRead float64 `json:\"price_cache_read,omitempty\"`\n}\n```\nPromoPricing is a time-bounded introductory or promotional rate card in models.json. While the current UTC date (YYYY-MM-DD) is within \\[From, Until] (inclusive; From is optional), its rates override the standing PriceIn / PriceOut / PriceCacheRead; once Until passes, standing pricing automatically takes effect with no code or catalog edit required.\n\n","path":"github.com/memcode-ai/memcode/catalog","name":"catalog","synopsis":"","isRedistributable":true}
