跳到主要内容
API 参考

音频 API

支持端点

音频 API

支持端点

  • POST /v1/audio/speech:文本转语音(TTS)
  • POST /v1/audio/transcriptions:语音转文本(STT)
  • POST /v1/audio/translations:音频翻译(输出英文文本)

基础地址:https://anideaai.com/v1

公共请求头

请求头必填说明
AuthorizationBearer sk-xxxxx

1) 文本转语音:POST /v1/audio/speech

请求参数

参数类型必填说明
modelstring语音模型,如 tts-1
inputstring要合成的文本(最大 4096 字符)
voicestring音色:alloy/echo/fable/onyx/nova/shimmer
response_formatstringmp3(默认)、wavaac
speednumber语速:0.25~4

cURL 示例

curl https://anideaai.com/v1/audio/speech \
-H "Authorization: Bearer sk-xxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "欢迎使用 AnideaAI"
}' \
--output speech.mp3

返回内容为音频二进制(如 audio/mpeg)。

2) 语音转文本:POST /v1/audio/transcriptions

请求参数(multipart/form-data

参数类型必填说明
filefile音频文件
modelstring识别模型,如 whisper-1
languagestringISO-639-1 语言码(如 zh
promptstring识别提示词
response_formatstringjson/text/srt/vtt
temperaturenumber采样温度

cURL 示例

curl https://anideaai.com/v1/audio/transcriptions \
-H "Authorization: Bearer sk-xxxxx" \
-F "file=@./meeting.m4a" \
-F "model=whisper-1" \
-F "language=zh" \
-F "response_format=json"

3) 音频翻译:POST /v1/audio/translations

请求参数(multipart/form-data

参数类型必填说明
filefile音频文件
modelstring翻译模型
promptstring额外提示
response_formatstring返回格式
temperaturenumber采样温度

cURL 示例

curl https://anideaai.com/v1/audio/translations \
-H "Authorization: Bearer sk-xxxxx" \
-F "file=@./speech_zh.mp3" \
-F "model=whisper-1"

响应示例(转录/翻译)

{
"text": "Welcome to AnideaAI"
}
这页有帮助吗?