跳到主要内容
API 参考

音频 API

支持端点

音频 API

支持端点​

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

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

公共请求头​

请求头必填说明
Authorization是Bearer sk-xxxxx

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

请求参数​

参数类型必填说明
modelstring是语音模型,如 tts-1
inputstring是要合成的文本(最大 4096 字符)
voicestring是音色:alloy/echo/fable/onyx/nova/shimmer
response_formatstring否mp3(默认)、wav、aac 等
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
languagestring否ISO-639-1 语言码(如 zh)
promptstring否识别提示词
response_formatstring否json/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"
}
这页有帮助吗?