跳到主要内容

音频接口

三个端点,均走 Authorization: Bearer ***。

语音合成 speech​

POST /v1/audio/speech

curl https://187api.com/v1/audio/speech \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "你好,世界",
"voice": "alloy"
}' \
--output speech.mp3

返回音频二进制。voice 可选值随模型而定。

语音转文字 transcriptions​

POST /v1/audio/transcriptions

curl https://187api.com/v1/audio/transcriptions \
-H "Authorization: Bearer ***" \
-F file=@audio.mp3 \
-F model=whisper-1

多部分表单上传。可加 -F language=zh、-F response_format=json。

语音翻译 translations​

POST /v1/audio/translations

用法同上,输出统一为英文翻译。

注意​

  • 音频端点走上游中转,模型名、语音、支持格式都取决于上游能力。
  • 大文件可能受请求体限制,超大音频需自行切分。