@@ -19,10 +19,9 @@ export async function getModel(): Promise<LanguageModel> {
1919 throw new Error ( 'OpenAI API key is not set' ) ;
2020 }
2121 const openai = createOpenAI ( {
22- compatibility : 'strict' , // strict mode, enabled when using the OpenAI API
2322 apiKey : config . openaiKey ,
2423 } ) ;
25- return openai ( model ) ;
24+ return openai . chat ( model ) ;
2625
2726 case 'anthropic' :
2827 if ( ! config . anthropicKey ) {
@@ -43,32 +42,29 @@ export async function getModel(): Promise<LanguageModel> {
4342 throw new Error ( 'Xai API key is not set' ) ;
4443 }
4544 const xai = createOpenAI ( {
46- compatibility : 'compatible' ,
4745 baseURL : 'https://api.x.ai/v1' ,
4846 apiKey : config . xaiKey ,
4947 } ) ;
50- return xai ( model ) ;
48+ return xai . chat ( model ) ;
5149
5250 case 'openrouter' :
5351 if ( ! config . openrouterKey ) {
5452 throw new Error ( 'OpenRouter API key is not set' ) ;
5553 }
5654 const openrouter = createOpenAI ( {
57- compatibility : 'compatible' ,
5855 baseURL : 'https://openrouter.ai/api/v1' ,
5956 apiKey : config . openrouterKey ,
6057 } ) ;
61- return openrouter ( model ) ;
58+ return openrouter . chat ( model ) ;
6259
6360 case 'custom' :
6461 if ( typeof aiBaseUrl !== 'string' ) {
6562 throw new Error ( 'Local AI base URL is not set' ) ;
6663 }
6764 const openaiCompatible = createOpenAI ( {
68- compatibility : 'compatible' ,
6965 apiKey : config . customApiKey || 'bogus' , // use custom API key if set, otherwise use a bogus key
7066 baseURL : aiBaseUrl ,
7167 } ) ;
72- return openaiCompatible ( model ) ;
68+ return openaiCompatible . chat ( model ) ;
7369 }
7470}
0 commit comments