Current (2023-03-01) OpenAI Whisper API expects a file uploaded as part of multipart/form-data
in POST request.
I initially struggled to use this API inside Node.js with an audio file stored inside an AWS s3 bucket, so I decided to share this snippet:
The API usage example from the OpenAI docs:
curl --request POST \
--url https://api.openai.com/v1/audio/transcriptions \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: multipart/form-data' \
--form file=@/path/to/file/openai.mp3 \
--form model=whisper-1
See the Node.js + AWS S3 example below:
I get an error at line 38 on [email protected]

getObjectOutput.Body in my case is a Readable Stream as below:
The error I get is:
TypeError: Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'.
Stuck here for past 3 hours. Please help.