@@ -165,9 +165,27 @@ function getSelectedModel({
165165 case "xai" : {
166166 const id = apiConfiguration . apiModelId ?? xaiDefaultModelId
167167 const dynamicInfo = routerModels . xai ?. [ id ]
168+ if ( dynamicInfo ) {
169+ return { id, info : dynamicInfo }
170+ }
168171 const staticInfo = xaiModels [ id as keyof typeof xaiModels ]
169- const info = dynamicInfo ?? staticInfo
170- return info ? { id, info } : { id, info : undefined }
172+ // Build a complete ModelInfo fallback to satisfy UI expectations until dynamic models load
173+ const info : ModelInfo = {
174+ ...openAiModelInfoSaneDefaults ,
175+ contextWindow :
176+ apiConfiguration . xaiModelContextWindow ??
177+ staticInfo ?. contextWindow ??
178+ openAiModelInfoSaneDefaults . contextWindow ,
179+ maxTokens : staticInfo ?. maxTokens ?? openAiModelInfoSaneDefaults . maxTokens ,
180+ supportsPromptCache : false , // Placeholder; dynamic API will provide real value
181+ supportsImages : false , // Placeholder; dynamic API will provide real value
182+ description : staticInfo ?. description ,
183+ supportsReasoningEffort :
184+ staticInfo && "supportsReasoningEffort" in staticInfo
185+ ? staticInfo . supportsReasoningEffort
186+ : undefined ,
187+ }
188+ return { id, info }
171189 }
172190 case "groq" : {
173191 const id = apiConfiguration . apiModelId ?? groqDefaultModelId
0 commit comments