MCPcopy Create free account
hub / github.com/IIIIQIIII/claude-code / get3PModelFallbackSuggestion

Function get3PModelFallbackSuggestion

src/services/api/errors.ts:938–957  ·  view source on GitHub ↗

* For 3P users, suggest a fallback model when the selected model is unavailable. * Returns a model name suggestion, or undefined if no suggestion is applicable.

(model: string)

Source from the content-addressed store, hash-verified

936 * Returns a model name suggestion, or undefined if no suggestion is applicable.
937 */
938function get3PModelFallbackSuggestion(model: string): string | undefined {
939 if (getAPIProvider() === 'firstParty') {
940 return undefined
941 }
942 // @[MODEL LAUNCH]: Add a fallback suggestion chain for the new model → previous version for 3P
943 const m = model.toLowerCase()
944 // If the failing model looks like an Opus 4.6 variant, suggest the default Opus (4.1 for 3P)
945 if (m.includes('opus-4-6') || m.includes('opus_4_6')) {
946 return getModelStrings().opus41
947 }
948 // If the failing model looks like a Sonnet 4.6 variant, suggest Sonnet 4.5
949 if (m.includes('sonnet-4-6') || m.includes('sonnet_4_6')) {
950 return getModelStrings().sonnet45
951 }
952 // If the failing model looks like a Sonnet 4.5 variant, suggest Sonnet 4
953 if (m.includes('sonnet-4-5') || m.includes('sonnet_4_5')) {
954 return getModelStrings().sonnet40
955 }
956 return undefined
957}
958
959/**
960 * Classifies an API error into a specific error type for analytics tracking.

Callers 1

Calls 2

getAPIProviderFunction · 0.85
getModelStringsFunction · 0.50

Tested by

no test coverage detected