OpenAI Whisper API错误: “您必须提供一个模型参数”

huangapple go评论73阅读模式
英文:

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文档

OpenAI Whisper API错误: “您必须提供一个模型参数”

如果您想使用Whisper API,请注意以下事项:

  1. 正确的API端点:https://api.openai.com/v1/audio/transcriptions
  2. 有两个必填参数:
    • 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.

OpenAI Whisper API错误: “您必须提供一个模型参数”

If you want to use the Whisper API, note the following:

  1. Correct API endpoint: https://api.openai.com/v1/audio/transcriptions
  2. 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 &#39;https://api.openai.com/v1/audio/transcriptions&#39; as the url.
And the model is assigned in the request body:

fetch(&#39;https://api.openai.com/v1/audio/transcriptions&#39;, {
  method: &#39;POST&#39;,
  headers: {
    &#39;Authorization&#39;: &#39;Bearer &lt;Your token&gt;&#39;
  },
  body: {
    model: &#39;whisper-1&#39;,
    file: &lt;Your audio file&gt;,
  }
});

huangapple
  • 本文由 发表于 2023年4月13日 20:36:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76005509.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定