diff --git a/src/openai/cli/_api/audio.py b/src/openai/cli/_api/audio.py index eaf57748ad..ca163b674b 100644 --- a/src/openai/cli/_api/audio.py +++ b/src/openai/cli/_api/audio.py @@ -65,6 +65,9 @@ def transcribe(args: CLITranscribeArgs) -> None: with open(args.file, "rb") as file_reader: buffer_reader = BufferReader(file_reader.read(), desc="Upload progress") + # add the file extension otherwise file format detection fails + buffer_reader.name = "audio." + args.file.split(".")[-1] + model = get_client().audio.transcriptions.create( file=buffer_reader, model=args.model, @@ -82,6 +85,8 @@ def translate(args: CLITranslationArgs) -> None: with open(args.file, "rb") as file_reader: buffer_reader = BufferReader(file_reader.read(), desc="Upload progress") + buffer_reader.name = "audio." + args.file.split(".")[-1] + model = get_client().audio.translations.create( file=buffer_reader, model=args.model,