MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / getModelFamilyInfo

Function getModelFamilyInfo

src/utils/model/modelOptions.ts:426–465  ·  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

424 * a specific older version pinned and a newer one is available.
425 */
426function getModelFamilyInfo(
427 model: string,
428): { alias: string; currentVersionName: string } | null {
429 const canonical = getCanonicalName(model)
430
431 // Sonnet family
432 if (
433 canonical.includes('claude-sonnet-4-6') ||
434 canonical.includes('claude-sonnet-4-5') ||
435 canonical.includes('claude-sonnet-4-') ||
436 canonical.includes('claude-3-7-sonnet') ||
437 canonical.includes('claude-3-5-sonnet')
438 ) {
439 const currentName = getMarketingNameForModel(getDefaultSonnetModel())
440 if (currentName) {
441 return { alias: 'Sonnet', currentVersionName: currentName }
442 }
443 }
444
445 // Opus family
446 if (canonical.includes('claude-opus-4')) {
447 const currentName = getMarketingNameForModel(getDefaultOpusModel())
448 if (currentName) {
449 return { alias: 'Opus', currentVersionName: currentName }
450 }
451 }
452
453 // Haiku family
454 if (
455 canonical.includes('claude-haiku') ||
456 canonical.includes('claude-3-5-haiku')
457 ) {
458 const currentName = getMarketingNameForModel(getDefaultHaikuModel())
459 if (currentName) {
460 return { alias: 'Haiku', currentVersionName: currentName }
461 }
462 }
463
464 return null
465}
466
467/**
468 * 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