创建转录

帖子 https://api.openai.com/v1/audio/transcriptions

将音频转录为输入语言。source

请求正文

要转录的音频文件对象(不是文件名),采用以下格式之一:flac、mp3、mp4、mpeg、mpga、m4a、ogg、wav 或 webm。source

要使用的模型的 ID。只whisper-1(由我们的开源 Whisper V2 模型提供支持)目前可用。source

输入音频的语言。以 ISO-639-1 格式提供输入语言将提高准确性和延迟时间。source

一个可选文本,用于引导模型的样式或继续上一个音频片段。提示应与音频语言匹配。source

输出的格式,位于以下选项之一中:json,text,srt,verbose_jsonvtt.source

采样温度,介于 0 和 1 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使其更加集中和确定。如果设置为 0,则模型将使用对数概率自动增加温度,直到达到某些阈值。source

要为此转录填充的时间戳粒度。response_format必须设置verbose_json以使用时间戳粒度。支持以下任一或两个选项:wordsegment.注意:段时间戳没有额外的延迟,但生成单词时间戳会产生额外的延迟。source

示例请求
1
2
3
4
5
curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@/path/to/file/audio.mp3" \
  -F model="whisper-1"
响应
1
2
3
{
  "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that."
}