I am using node js for open ai api. However, whenever I make an API call, I get this error:
Error: BadRequestError: {"message":"","type":"server_error","param":null,"code":null}
at APIError.generate (/mnt/2tbdir/VSCodeProjects/sovarapp/backend/node_modules/openai/error.js:46:14)
at OpenAI.makeStatusError (/mnt/2tbdir/VSCodeProjects/sovarapp/backend/node_modules/openai/core.js:312:29)
at OpenAI.makeRequest (/mnt/2tbdir/VSCodeProjects/sovarapp/backend/node_modules/openai/core.js:352:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async transcribe (/mnt/2tbdir/VSCodeProjects/sovarapp/backend/index.js:23:22)
at async /mnt/2tbdir/VSCodeProjects/sovarapp/backend/index.js:38:26 {
status: 400,
headers: {
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '7ffad3a8eaef17ea-SJC',
connection: 'keep-alive',
'content-length': '103',
'content-type': 'application/json',
date: 'Fri, 01 Sep 2023 04:39:03 GMT',
'openai-processing-ms': '67',
'openai-version': '2020-10-01',
server: 'cloudflare',
'strict-transport-security': 'max-age=15724800; includeSubDomains',
'x-ratelimit-limit-requests': '50',
'x-ratelimit-remaining-requests': '49',
'x-ratelimit-reset-requests': '1.2s',
'x-request-id': '126fd61b368199767f3aec49ff25eef5'
},
error: { message: '', type: 'server_error', param: null, code: null },
code: null,
param: null,
type: 'server_error'
}
Here is my code for the API call:
const type = await fileType.fromBuffer(audioFile);
console.log(`Detected file type: ${JSON.stringify(type)}`);
const response = await openai.audio.transcriptions.create({
file: audioFile, // The audio file to transcribe.
model: "whisper-1", // The model to use for transcription.
response_format: 'json', // The format of the transcription.
language: 'en' // Language
});
The file type of audioFile is m4a, which is supported when I checked the docs. Can someone please help me?