MCPcopy Create free account
hub / github.com/freecodexyz/free-code / getModelFamilyInfo

Function getModelFamilyInfo

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

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