@@ -229,6 +229,8 @@ public virtual AsyncCollectionResult<StreamingAudioTranscriptionUpdate> Transcri
229229 Argument . AssertNotNull ( audio , nameof ( audio ) ) ;
230230 Argument . AssertNotNullOrEmpty ( audioFilename , nameof ( audioFilename ) ) ;
231231
232+ EnsureModelSupportsStreaming ( ) ;
233+
232234 MultiPartFormDataBinaryContent content
233235 = CreatePerCallTranscriptionOptions ( options , stream : true )
234236 . ToMultipartContent ( audio , audioFilename ) ;
@@ -245,6 +247,8 @@ public virtual AsyncCollectionResult<StreamingAudioTranscriptionUpdate> Transcri
245247 {
246248 Argument . AssertNotNullOrEmpty ( audioFilePath , nameof ( audioFilePath ) ) ;
247249
250+ EnsureModelSupportsStreaming ( ) ;
251+
248252 FileStream inputStream = File . OpenRead ( audioFilePath ) ;
249253
250254 MultiPartFormDataBinaryContent content
@@ -266,6 +270,8 @@ public virtual CollectionResult<StreamingAudioTranscriptionUpdate> TranscribeAud
266270 Argument . AssertNotNull ( audio , nameof ( audio ) ) ;
267271 Argument . AssertNotNullOrEmpty ( audioFilename , nameof ( audioFilename ) ) ;
268272
273+ EnsureModelSupportsStreaming ( ) ;
274+
269275 MultiPartFormDataBinaryContent content
270276 = CreatePerCallTranscriptionOptions ( options , stream : true )
271277 . ToMultipartContent ( audio , audioFilename ) ;
@@ -282,6 +288,8 @@ public virtual CollectionResult<StreamingAudioTranscriptionUpdate> TranscribeAud
282288 {
283289 Argument . AssertNotNullOrEmpty ( audioFilePath , nameof ( audioFilePath ) ) ;
284290
291+ EnsureModelSupportsStreaming ( ) ;
292+
285293 FileStream inputStream = File . OpenRead ( audioFilePath ) ;
286294
287295 MultiPartFormDataBinaryContent content
@@ -296,6 +304,20 @@ MultiPartFormDataBinaryContent content
296304 return result ;
297305 }
298306
307+ private void EnsureModelSupportsStreaming ( )
308+ {
309+ if ( string . Equals ( _model , "whisper-1" , StringComparison . OrdinalIgnoreCase ) )
310+ {
311+ string isEnabled = Environment . GetEnvironmentVariable ( "OPENAI_ENABLE_WHISPER_1_STREAMING" ) ;
312+ if ( ! string . Equals ( isEnabled , "true" , StringComparison . OrdinalIgnoreCase ) )
313+ {
314+ throw new NotSupportedException (
315+ "The selected model 'whisper-1' does not support streaming transcription. " +
316+ "Please use a compatible model or set the environment variable 'OPENAI_ENABLE_WHISPER_1_STREAMING=true' to bypass this check." ) ;
317+ }
318+ }
319+ }
320+
299321 #endregion
300322
301323 #region TranslateAudio
0 commit comments