@@ -85,8 +85,20 @@ export function buildOpenAICompatibleProvider(
8585 responseChat = await fetch ( `${ config . baseUrl as string } chat/completions` , { headers : { Authorization : `Bearer ${ config . apiKey } ` , ...additionalHeaders } , method : 'POST' , body : '{"model": "test"}' } )
8686 responseModelList = await fetch ( `${ config . baseUrl as string } models` , { headers : { Authorization : `Bearer ${ config . apiKey } ` , ...additionalHeaders } } )
8787
88- if ( ! ( [ 200 , 400 , 401 ] . includes ( responseChat . status ) || [ 200 , 400 , 401 ] . includes ( responseModelList . status ) ) ) {
89- errors . push ( new Error ( `Invalid Base URL, ${ config . baseUrl } is not supported` ) )
88+ // Also try transcription endpoints for speech recognition servers
89+ let responseTranscription = null
90+ try {
91+ // Sending empty FormData is fine; 400 still counts as a valid endpoint
92+ responseTranscription = await fetch ( `${ config . baseUrl as string } audio/transcriptions` , { headers : { Authorization : `Bearer ${ config . apiKey } ` , ...additionalHeaders } , method : 'POST' , body : new FormData ( ) } )
93+ }
94+ catch {
95+ // Transcription endpoint might not exist, that's okay
96+ }
97+
98+ // Accept if any of the endpoints work (chat, models, or transcription)
99+ const validResponses = [ responseChat , responseModelList , responseTranscription ] . filter ( r => r && [ 200 , 400 , 401 ] . includes ( r . status ) )
100+ if ( validResponses . length === 0 ) {
101+ errors . push ( new Error ( `Invalid Base URL, ${ config . baseUrl } is not supported. Make sure your server supports OpenAI-compatible endpoints.` ) )
90102 }
91103 }
92104 catch ( e ) {
0 commit comments