跳转到主要内容

请求体

file
file
必填
要转录的音频文件。支持的格式:flac、mp3、mp4、mpeg、mpga、m4a、ogg、wav、webm。
model
string
默认值:"whisper-1"
要使用的模型。目前仅支持 whisper-1
language
string
音频的语言,采用 ISO-639-1 格式(例如:enzhja)。
prompt
string
可选文本,用于引导模型的风格或续接上一段内容。
response_format
string
默认值:"json"
输出格式:jsontextsrtverbose_jsonvtt
temperature
number
默认值:"0"
采样温度(0 到 1)。
timestamp_granularities
array
时间戳粒度:word 和/或 segment。需要 verbose_json

响应

text
string
转录后的文本。
对于 verbose_json
task
string
始终为 transcribe
language
string
检测到的语言。
duration
number
音频时长,单位为秒。
segments
array
带时间戳的转录片段。
words
array
词级时间戳(如已请求)。
curl -X POST "https://api.lemondata.cc/v1/audio/transcriptions" \
  -H "Authorization: Bearer sk-your-api-key" \
  -F file="@audio.mp3" \
  -F model="whisper-1" \
  -F language="en"
{
  "text": "Hello, this is a test of the transcription API."
}

翻译

要将音频翻译为英语,请使用 translations endpoint:
response = client.audio.translations.create(
    model="whisper-1",
    file=audio_file
)