API 參考
文字轉語音
POST
/v1/audio/speech合成語音,成功時傳回依模型而定的音訊二進位資料,預設格式由所選模型決定。不自動轉存,不傳回新增檔案封存回應標頭;請勿將音訊當作 JSON。
鑑權與許可權
使用當前 GloopAPI Key。模型、功能與許可權以當前 Key 的目錄及介面說明為準。
Authorization: Bearer $GLOOP_API_KEY鑑權方案: BearerAuth
請求
請求體 · application/json
- 型別
- object
- 必填欄位
modelinputvoice
請求體必填
modelstring必填inputstring必填待合成文字;長度限制取決於所選模型,沒有統一的 4096 字元上限。
voicestring必填具體支援與限制取所選模型,不保證統一預設值。
response_formatstring選填請求音訊輸出格式,支援值及省略時格式由所選模型決定;平臺通用入口不賦予 mp3 預設。
speednumber選填具體支援與限制取所選模型,不保證統一預設值。
instructionsstring選填模型相關語音指導。
stream_formatstring選填模型相關流格式;不保證所有模型支援 SSE。
響應與錯誤
HTTP 200
成功生成音訊
audio/mpeg
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}audio/wav
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}audio/ogg
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}audio/flac
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}audio/aac
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}application/octet-stream
- 型別
- string
- 格式
- binary
- 說明
- 音訊位元組流,儲存為檔案。
{
"type": "string",
"format": "binary",
"description": "音频字节流,保存为文件。"
}HTTP 401
Key 缺失、無效、過期或已撤銷。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 403
IP、賬戶、模型或工具許可權不足。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 429
請求/佇列限流。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填
HTTP 500
鑑權或資料儲存內部失敗。
application/json
- 型別
- object
- 必填欄位
error
errorobject必填error 子欄位(4)
codestring選填messagestring選填typestring選填request_idstring選填