@@ -440,7 +440,7 @@ export type ProviderSettingsWithId = z.infer<typeof providerSettingsWithIdSchema
440440
441441export const PROVIDER_SETTINGS_KEYS = providerSettingsSchema . keyof ( ) . options
442442
443- export const MODEL_ID_KEYS : Partial < keyof ProviderSettings > [ ] = [
443+ export const modelIdKeys = [
444444 "apiModelId" ,
445445 "glamaModelId" ,
446446 "openRouterModelId" ,
@@ -455,11 +455,52 @@ export const MODEL_ID_KEYS: Partial<keyof ProviderSettings>[] = [
455455 "ioIntelligenceModelId" ,
456456 "vercelAiGatewayModelId" ,
457457 "deepInfraModelId" ,
458- ]
458+ ] as const satisfies readonly ( keyof ProviderSettings ) [ ]
459+
460+ export type ModelIdKey = ( typeof modelIdKeys ) [ number ]
459461
460462export const getModelId = ( settings : ProviderSettings ) : string | undefined => {
461- const modelIdKey = MODEL_ID_KEYS . find ( ( key ) => settings [ key ] )
462- return modelIdKey ? ( settings [ modelIdKey ] as string ) : undefined
463+ const modelIdKey = modelIdKeys . find ( ( key ) => settings [ key ] )
464+ return modelIdKey ? settings [ modelIdKey ] : undefined
465+ }
466+
467+ export const modelIdKeysByProvider : Record < ProviderName , ModelIdKey > = {
468+ anthropic : "apiModelId" ,
469+ "claude-code" : "apiModelId" ,
470+ glama : "glamaModelId" ,
471+ openrouter : "openRouterModelId" ,
472+ bedrock : "apiModelId" ,
473+ vertex : "apiModelId" ,
474+ openai : "openAiModelId" ,
475+ ollama : "ollamaModelId" ,
476+ "vscode-lm" : "apiModelId" , // This doesn't appear to use `ModelIdKey` at all.
477+ lmstudio : "lmStudioModelId" ,
478+ gemini : "apiModelId" ,
479+ "gemini-cli" : "apiModelId" ,
480+ "openai-native" : "openAiModelId" ,
481+ mistral : "apiModelId" ,
482+ moonshot : "apiModelId" ,
483+ deepseek : "apiModelId" ,
484+ deepinfra : "deepInfraModelId" ,
485+ doubao : "apiModelId" ,
486+ "qwen-code" : "apiModelId" ,
487+ unbound : "unboundModelId" ,
488+ requesty : "requestyModelId" ,
489+ "human-relay" : "apiModelId" ,
490+ "fake-ai" : "apiModelId" ,
491+ xai : "apiModelId" ,
492+ groq : "apiModelId" ,
493+ chutes : "apiModelId" ,
494+ litellm : "litellmModelId" ,
495+ huggingface : "huggingFaceModelId" ,
496+ cerebras : "apiModelId" ,
497+ sambanova : "apiModelId" ,
498+ zai : "apiModelId" ,
499+ fireworks : "apiModelId" ,
500+ featherless : "apiModelId" ,
501+ "io-intelligence" : "ioIntelligenceModelId" ,
502+ roo : "apiModelId" ,
503+ "vercel-ai-gateway" : "vercelAiGatewayModelId" ,
463504}
464505
465506// Providers that use Anthropic-style API protocol.
0 commit comments