跳转至

MaaS ASpeech/OSpeech

请求方法:

POST

请求路径:

https://genaiapi.cloudsway.net/v1/{endpoint}/audio/speech

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer xxxxxx

请求Body

参数 描述 示例
model 使用模型 MaaS ASpeech
input 需要生成音频的文本 how are you
voice 当生成音频时可选用的声音
可选值:
"alloy", "echo", "fable", "onyx", "nova", "shimmer"
alloy
response_format 音频格式
可选值: "mp3", "opus", "aac", "flac", "wav", "pcm"
mp3
speed 音频速度
范围是: 0.25 to 4.0.
1.0

返回值

文件流

请求样例

MaaS ASpeech

curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/audio/speech' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{
    "input":"<speak version='\''1.0'\'' xml:lang='\''en-US'\''><voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-AvaMultilingualNeural'\''>my voice is my passport verify me</voice></speak>",
    "response_format":"audio-16khz-128kbitrate-mono-mp3"
}'

MaaS OSpeech

curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/audio/speech' \
--header 'Authorization: Bearer xxxx' \
--header 'Content-Type: application/json' \
--data '{
    "input":"hi,what is your name?",
    "voice":"alloy",
    "speed":1.0,
    "response_format":"mp3"
}'

获取MaaS ASpeech区域语音列表

请求方法

GET

请求路径

{endpointPath}/cognitiveservices/voices/list

请求header

参数 描述 示例
Authorization AccessKey
Bearer ${AccessKey}
Bearer xxxxxx

返回参数

对象数组

对象参数:

参数 描述 示例
Name 语音全称 Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)
DisplayName 展示名称 Adri
LocalName 本地名称 Adri
ShortName 简称 af-ZA-AdriNeural
Gender 语音性别 Female
Locale 语言环境 af-ZA
LocaleName 语言环境名称 Afrikaans (South Africa)
SampleRateHertz 采样赫兹 48000
VoiceType 语音类型 Neural
Status 状态 GA
WordsPerMinute 每分钟读单词数量 147

请求样例

curl --location '{endpointPath}/cognitiveservices/voices/list' \
--header 'Authorization: Bearer xxxx'