跳轉到主要內容
POST
/
v1
/
audio
/
transcriptions
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."
}

請求主體

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."
}

翻譯

若要將音訊翻譯為英文,請使用翻譯端點:
response = client.audio.translations.create(
    model="whisper-1",
    file=audio_file
)