Hi, I’m trying to put my hands on the wisper model by calling the API but I keep getting 404 ERR_BAD_REQUEST errors.
I’ve been refering to the API reference doc
Here is my code :
const filePath = path.join(__dirname, 'test.mp3');
const model = 'wisper-1';
const formData = new FormData();
formData.append('model', model);
formData.append('file', fs.createReadStream(filePath));
axios.post('https://api.openai.com/v1/audio/transcriptions', formData, {
headers: {
'Authorization': `Bearer ${OPENAI_API_KEY}`,
'Content-Type': `multipart/form-data; boundary=${formData._boundary}`,
}
}).then((response) => {
console.log(response.data);
}).catch((error) => {
console.log(error);
})
Here is the request headers:
_header: 'POST /v1/audio/transcriptions HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Content-Type: multipart/form-data; boundary=--------------------------761737157678905338001563\r\n' + 'Authorization: Bearer TOKEN\r\n' + 'User-Agent: axios/1.3.4\r\n' + 'Content-Length: 371910\r\n' + 'Accept-Encoding: gzip, compress, deflate, br\r\n' + 'Host: api.openai.com\r\n' + 'Connection: close\r\n' + '\r\n',
And the response headers:
response: {
status: 404,
statusText: ‘Not Found’,
headers: AxiosHeaders {
date: ‘Wed, 08 Mar 2023 21:47:13 GMT’,
‘content-type’: ‘application/json; charset=utf-8’,
‘content-length’: ‘158’,
connection: ‘close’,
vary: ‘Origin’,
‘x-request-id’: ‘fc1cf382e17f5f22aec49808b’,
‘strict-transport-security’: ‘max-age=15724800; includeSubDomains’
}
My API key works fine with chat-GPT, and if I change it here I get a 401, so the authentication passes.
I don’t see where I’m mistaking. Any idea ?