API 参考
音频
暂时没有可用模型
目前模型目录里没有模型支持这个接口,本页仅供参考。
POST
/v1/audio/speechPOST
/v1/audio/transcriptionsPOST
/v1/audio/translations语音双向:/v1/audio/speech 把文本合成为音频字节;/v1/audio/transcriptions 把音频转成文字(Whisper 兼容);/v1/audio/translations 直接转写成英文。
#请求参数
modelstring必填speech 用 tts-1 一类;转写用 whisper-1 一类。
inputstring必填仅 speech:要朗读的文本。
voicestring必填仅 speech:音色名(alloy、nova……);可用音色见模型卡。
filefile (multipart)必填仅 transcriptions:音频文件(mp3、wav、m4a、webm……)。
languagestring可选仅 transcriptions:ISO-639-1 语言提示,可提高准确率。
response_formatstring可选speech:mp3 | wav | opus……;transcriptions:json | text | srt | verbose_json。
speednumber可选仅 speech:0.25–4.0 倍速。
两种不同的 Content-Type
speech 收 JSON、返回音频字节;transcriptions/translations 收 multipart/form-data、返回 JSON。别混用。
#相关错误码
- 413 payload_too_large请求体(prompt、图片或音频文件)超出大小限制。
- 401Bearer 令牌无效或缺失。这条路径不带 error.code,请按状态码判断。
- 402 insufficient_user_quota钱包余额不足以覆盖预扣估算。
- 429密钥级限流。响应体为空,按 Retry-After 等待。若 429 带有 insufficient_user_quota,那是每日消费上限,不是限流。
- 503 model_not_found模型名不存在,或当前没有健康渠道可以服务它。
#请求示例
# text → speech (bytes saved to file)
curl https://www.aisplice.store/v1/audio/speech \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "tts-1", "voice": "alloy", "input": "Hello from the gateway."}' \
--output hello.mp3
# speech → text (multipart)
curl https://www.aisplice.store/v1/audio/transcriptions \
-H "Authorization: Bearer sk-YOUR_KEY" \
-F file=@meeting.mp3 -F model=whisper-1#响应
response.json
// /v1/audio/speech → binary audio body (Content-Type: audio/mpeg)
// /v1/audio/transcriptions
{"text": "…transcript…"}还是没解决?
把请求 ID 或报错信息发给我们,我们来查。