I am converting my recorded audio file to a blob object and then reading it with file reader to make a post request to open ai whisper modelIt expects a audio file and model name i.e whisper-1
The error i am getting is
1 validation error for Request\nbody -> file\n field required (type=value_error.missing)
my code is below
const handleUpload = () => { const audioBlob = new Blob(audioChunks, { type: "audio/webm" }); const reader = new FileReader(); reader.readAsDataURL(audioBlob); reader.onload = async () => { const audioBase64 = await reader.result.split(",")[1]; const payload = { audio: audioBase64, model: "whisper-1", }; const payloadString = JSON.stringify(payload); fetch("https://api.openai.com/v1/audio/transcriptions", { method: "POST", headers: {"Content-Type": "application/json", Authorization: `Bearer ${key}`, }, body: payloadString, }) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error(error)); }; };