MCPcopy
hub / github.com/codeaashu/claude-code / getModelFamilyInfo

Function getModelFamilyInfo

src/utils/model/modelOptions.ts:385–424  ·  view source on GitHub ↗

* Map a full model name to its family alias and the marketing name of the * version the alias currently resolves to. Used to detect when a user has * a specific older version pinned and a newer one is available.

(
  model: string,
)

Source from the content-addressed store, hash-verified

383 * a specific older version pinned and a newer one is available.
384 */
385function getModelFamilyInfo(
386 model: string,
387): { alias: string; currentVersionName: string } | null {
388 const canonical = getCanonicalName(model)
389
390 // Sonnet family
391 if (
392 canonical.includes('claude-sonnet-4-6') ||
393 canonical.includes('claude-sonnet-4-5') ||
394 canonical.includes('claude-sonnet-4-') ||
395 canonical.includes('claude-3-7-sonnet') ||
396 canonical.includes('claude-3-5-sonnet')
397 ) {
398 const currentName = getMarketingNameForModel(getDefaultSonnetModel())
399 if (currentName) {
400 return { alias: 'Sonnet', currentVersionName: currentName }
401 }
402 }
403
404 // Opus family
405 if (canonical.includes('claude-opus-4')) {
406 const currentName = getMarketingNameForModel(getDefaultOpusModel())
407 if (currentName) {
408 return { alias: 'Opus', currentVersionName: currentName }
409 }
410 }
411
412 // Haiku family
413 if (
414 canonical.includes('claude-haiku') ||
415 canonical.includes('claude-3-5-haiku')
416 ) {
417 const currentName = getMarketingNameForModel(getDefaultHaikuModel())
418 if (currentName) {
419 return { alias: 'Haiku', currentVersionName: currentName }
420 }
421 }
422
423 return null
424}
425
426/**
427 * Returns a ModelOption for a known Anthropic model with a human-readable

Callers 1

getKnownModelOptionFunction · 0.85

Calls 5

getCanonicalNameFunction · 0.85
getMarketingNameForModelFunction · 0.85
getDefaultSonnetModelFunction · 0.85
getDefaultOpusModelFunction · 0.85
getDefaultHaikuModelFunction · 0.85

Tested by

no test coverage detected