@@ -35,22 +35,19 @@ export class XAIHandler extends BaseProvider implements SingleCompletionHandler
3535 }
3636
3737 override getModel ( ) {
38- const id =
39- this . options . apiModelId && this . options . apiModelId in xaiModels
40- ? ( this . options . apiModelId as XAIModelId )
41- : xaiDefaultModelId
38+ // Allow any model ID (dynamic discovery) and augment with static info when available
39+ const id = this . options . apiModelId ?? xaiDefaultModelId
4240
43- const staticInfo = xaiModels [ id ]
41+ const staticInfo = ( xaiModels as Record < string , any > ) [ id as any ]
4442
45- // Build complete ModelInfo with all required fields
46- // Dynamic data (pricing, cache support) will come from router models, this is just for type safety
43+ // Build complete ModelInfo with required fields; dynamic data comes from router models
4744 const info : ModelInfo = {
48- contextWindow : this . options . xaiModelContextWindow ?? staticInfo . contextWindow ,
49- maxTokens : staticInfo . maxTokens ?? undefined ,
45+ contextWindow : this . options . xaiModelContextWindow ?? staticInfo ? .contextWindow ,
46+ maxTokens : staticInfo ? .maxTokens ?? undefined ,
5047 supportsPromptCache : false , // Placeholder - actual value comes from dynamic API call
51- description : staticInfo . description ,
48+ description : staticInfo ? .description ,
5249 supportsReasoningEffort :
53- "supportsReasoningEffort" in staticInfo ? staticInfo . supportsReasoningEffort : undefined ,
50+ staticInfo && "supportsReasoningEffort" in staticInfo ? staticInfo . supportsReasoningEffort : undefined ,
5451 }
5552
5653 const params = getModelParams ( { format : "openai" , modelId : id , model : info , settings : this . options } )
0 commit comments