MaaS-Ele TextToSpeech
1、请求方法
POST
2、请求路径
/tts-e/text-to-speech/{voice_id}
3、路径变量
| 参数 | 描述 | 示例 | 
|---|---|---|
| voice_id | 语音id,详情见附录 | EXAVITQu4vr4xnSDxMaL | 
4、请求参数
| 参数 | 描述 | 示例 | 
|---|---|---|
| enable_logging | 是否是隐私模式,  true:(default)非隐私模式 false:隐私模式  | 
true | 
| optimize_streaming_latency | 延迟优化(已弃用参数) 可选值:1-4  | 
1 | 
| output_format | 输出格式  可选值: mp3_22050_32 mp3_44100_32 mp3_44100_64 mp3_44100_96 mp3_44100_128 (default) mp3_44100_192 pcm_16000 pcm_22050 pcm_24000 pcm_44100 ulaw_8000  | 
mp3_44100_128 | 
5、请求header
| 参数 | 描述 | 示例 | 
|---|---|---|
| Authorization | AccessKey Bearer ${AccessKey} | Bearer Yhq1NXXXX0Gd | 
6、请求Body
| 参数 | 必填 | 描述 | 示例 | 
|---|---|---|---|
| text | 是 | 文本(required) | how are you | 
| model_id | 否 | 模型ID 可选值: eleven_monolingual_v1(default) eleven_multilingual_v2 eleven_turbo_v2_5 eleven_turbo_v2 eleven_multilingual_v1 eleven_monolingual_v1  | 
1 | 
| language_code | 否 | 语言编码,目前只有eleven_turbo_v2_5支持该参数 | ISO 639-1 | 
| voice_settings | 否 | 语音设置 | {"stability":0,"similarity_boost":1.0} | 
| voice_settings.stability | 否 | 稳定度 | 0 | 
| voice_settings.similarity_boost | 否 | 相似度 | 1.0 | 
| voice_settings.style | 否 | 语音风格 | 0 | 
| voice_settings.use_speaker_boost | 否 | 是否使用语音增强  true(default)/false  | 
true | 
| pronunciation_dictionary_locators | 否 | object[] 发音字典定位器列表,最多支持3个  | 
"pronunciation_dictionary_locators": [{"pronunciation_dictionary_id": " | 
| pronunciation_dictionary_locators.pronunciation_dictionary_id | 否 | 发音字典id | 123 | 
| pronunciation_dictionary_locators.version_id | 否 | 版本id | 123 | 
| seed | 否 | 确定性采样 | 123 | 
| previous_text | 否 | 上一个文本内容 | hi | 
| next_text | 否 | 下一个文本内容 | how are you | 
| previous_request_ids | 否 | string[] 上一个样本请求id列表  | 
["xx","xxx"] | 
| next_request_ids | 否 | string[] 下一个样本请求id列表  | 
["xx","xxx"] | 
7、返回值header
| 参数 | 描述 | 示例 | 
|---|---|---|
| character-cost | 字符大小 | 333 | 
| request-id | 请求id | 12342wqwqe | 
8、返回值
文件流
9、请求样例
curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/tts-e/text-to-speech/{voice_id}' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'Content-Type: application/json' \
--data '{
  "text": "hi",
  "voice_settings": {
    "stability": 0,
    "similarity_boost": 1.0
  }
}'
10、附录
- 可选voice_id
 
| name | voice_id | 
|---|---|
| Sarah | EXAVITQu4vr4xnSDxMaL | 
| Laura | FGY2WhTYpPnrIDTdsKH5 | 
| Charlie | IKne3meq5aSn9XLyUdCD | 
| George | JBFqnCBsd6RMkjVDRZzb | 
| Callum | N2lVS1w4EtoT3dr4eOWO | 
| Liam | TX3LPaxmHKxFdv7VOQHJ | 
| Charlotte | XB0fDUnXU5powFXDhCwa | 
| Alice | Xb7hH8MSUJpSbSDYk0k2 | 
| Matilda | XrExE9yKIg1WjnnlVkGX | 
| Will | bIHbv24MWmeRgasZH58o | 
| Jessica | cgSgspJ2msm6clMCkdW9 | 
| Eric | cjVigY5qzO86Huf0OWal | 
| Chris | iP95p4xoKVk53GoZ742B | 
| Brian | nPczCjzI2devNBz1zQrb | 
| Daniel | onwK4e9ZLuTAKqWW03F9 | 
| Lily | pFZP5JQG7iQjIQuC4Bku | 
| Bill | pqHfZKP75CvOlQylNhV4 |