英文:
OpenAI Whisper API error: "You must provide a model parameter"
问题
I am testing a script to convert audio to text. However, while calling the API I am getting an error.
Here is the path I am using
https://api.openai.com/v1/audio/transcriptions?engine=whisper-1
And the error I am getting is
"message": "you must provide a model parameter",
"type": "invalid_request_error",
"param": null,
"code": null
}
I have tried model=whisper-1
and model=davinci-002
, both of them are raising the same error. Is there anything that I am missing?
英文:
I am testing a script to convert audio to text. However, while calling the API I am getting an error.
Here is the path I am using
'https://api.openai.com/v1/audio/transcriptions?engine=whisper-1';
And the error I am getting is
"error": {
"message": "you must provide a model parameter",
"type": "invalid_request_error",
"param": null,
"code": null
}
I have tried model=whisper-1
and model=davinci-002
, both of them are raising the same error. Is there anything that I am missing?
答案1
得分: 0
以下是翻译好的部分:
查看官方OpenAI文档。
如果您想使用Whisper API,请注意以下事项:
- 正确的API端点:
https://api.openai.com/v1/audio/transcriptions
- 有两个必填参数:
file
model
尝试这样做:
fetch('https://api.openai.com/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-xxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'multipart/form-data',
},
body: {
file: 'YOUR_AUDIO_FILE.mp3',
model: 'whisper-1',
}
});
英文:
Take a look at the official OpenAI documentation.
If you want to use the Whisper API, note the following:
- Correct API endpoint:
https://api.openai.com/v1/audio/transcriptions
- There are two required parameters:
file
model
Try this:
fetch('https://api.openai.com/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk-xxxxxxxxxxxxxxxxxxxx',
'Content-Type': 'multipart/form-data',
},
body: {
file: 'YOUR_AUDIO_FILE.mp3',
model: 'whisper-1',
}
});
答案2
得分: 0
You should use https://api.openai.com/v1/audio/transcriptions
as the url.
And the model is assigned in the request body:
fetch('https://api.openai.com/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer <Your token>'
},
body: {
model: 'whisper-1',
file: <Your audio file>,
}
});
英文:
You should use 'https://api.openai.com/v1/audio/transcriptions'
as the url.
And the model is assigned in the request body:
fetch('https://api.openai.com/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Authorization': 'Bearer <Your token>'
},
body: {
model: 'whisper-1',
file: <Your audio file>,
}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论