@@ -166,6 +166,16 @@ export function getProviderFileAttachment(providerId: string): ProviderFileAttac
166166 return PROVIDER_DEFINITIONS [ providerId ] ?. fileAttachment ?? DEFAULT_FILE_ATTACHMENT
167167}
168168
169+ const CLAUDE_5_1_TOOL_CAPABILITIES = { forcedToolUse : false } as const satisfies ModelCapabilities
170+
171+ /** Known capabilities for model aliases; explicit catalog capabilities take precedence. */
172+ const MODEL_CAPABILITY_FALLBACKS = [
173+ {
174+ pattern : / (?: ^ | [ / . ] ) c l a u d e - (?: f a b l e | m y t h o s ) - 5 - 1 (?: $ | [ - : ] ) / ,
175+ capabilities : CLAUDE_5_1_TOOL_CAPABILITIES ,
176+ } ,
177+ ] satisfies { pattern : RegExp ; capabilities : ModelCapabilities } [ ]
178+
169179export const PROVIDER_DEFINITIONS : Record < string , ProviderDefinition > = {
170180 fireworks : {
171181 id : 'fireworks' ,
@@ -916,7 +926,7 @@ export const PROVIDER_DEFINITIONS: Record<string, ProviderDefinition> = {
916926 updatedAt : '2026-09-04' ,
917927 } ,
918928 capabilities : {
919- forcedToolUse : false ,
929+ ... CLAUDE_5_1_TOOL_CAPABILITIES ,
920930 nativeStructuredOutputs : true ,
921931 maxOutputTokens : 128000 ,
922932 promptCaching : { minimumCacheableTokens : 512 } ,
@@ -4387,25 +4397,36 @@ export function getModelPricing(modelId: string): ModelPricing | null {
43874397}
43884398
43894399export function getModelCapabilities ( modelId : string ) : ModelCapabilities | null {
4400+ const normalizedModel = modelId . toLowerCase ( )
4401+ const fallbackCapabilities = MODEL_CAPABILITY_FALLBACKS . find ( ( { pattern } ) =>
4402+ pattern . test ( normalizedModel )
4403+ ) ?. capabilities
4404+
43904405 for ( const provider of Object . values ( PROVIDER_DEFINITIONS ) ) {
4391- const model = provider . models . find ( ( m ) => m . id . toLowerCase ( ) === modelId . toLowerCase ( ) )
4406+ const model = provider . models . find ( ( m ) => m . id . toLowerCase ( ) === normalizedModel )
43924407 if ( model ) {
4393- const capabilities : ModelCapabilities = { ...provider . capabilities , ...model . capabilities }
4408+ const capabilities : ModelCapabilities = {
4409+ ...provider . capabilities ,
4410+ ...fallbackCapabilities ,
4411+ ...model . capabilities ,
4412+ }
43944413 return capabilities
43954414 }
43964415 }
43974416
43984417 for ( const provider of Object . values ( PROVIDER_DEFINITIONS ) ) {
43994418 if ( provider . modelPatterns ) {
44004419 for ( const pattern of provider . modelPatterns ) {
4401- if ( pattern . test ( modelId . toLowerCase ( ) ) ) {
4402- return provider . capabilities || null
4420+ if ( pattern . test ( normalizedModel ) ) {
4421+ return fallbackCapabilities
4422+ ? { ...provider . capabilities , ...fallbackCapabilities }
4423+ : provider . capabilities || null
44034424 }
44044425 }
44054426 }
44064427 }
44074428
4408- return null
4429+ return fallbackCapabilities || null
44094430}
44104431
44114432export function getModelsWithTemperatureSupport ( ) : string [ ] {
@@ -4484,18 +4505,10 @@ export function supportsToolUsageControl(providerId: string): boolean {
44844505 return getProvidersWithToolUsageControl ( ) . includes ( providerId )
44854506}
44864507
4487- /** Whether the model accepts forced tool choice, including uncataloged Claude aliases . */
4508+ /** Whether the model accepts forced tool choice. */
44884509export function supportsForcedToolUse ( modelId : string ) : boolean {
44894510 const capabilities = getModelCapabilities ( modelId )
4490- if ( capabilities ?. forcedToolUse !== undefined ) return capabilities . forcedToolUse
4491-
4492- /** Preserve the restriction for date-suffixed and reseller IDs outside the catalog. */
4493- const normalizedModel = modelId . toLowerCase ( )
4494- if ( normalizedModel . includes ( 'fable-5-1' ) || normalizedModel . includes ( 'mythos-5-1' ) ) {
4495- return false
4496- }
4497-
4498- return capabilities ?. toolUsageControl ?? false
4511+ return capabilities ?. forcedToolUse ?? capabilities ?. toolUsageControl ?? false
44994512}
45004513
45014514export function updateOllamaModels ( models : string [ ] ) : void {
0 commit comments