Skip to content

MaaS_Az_tts/Op_tts

Text To Speech Interface

Request URL

POST https://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/audio/speech

Request Parameters

Parameter Description Example
model Use Model MaaS ASpeech
input Text that needs to generate audio how are you
voice Available sounds when generating audio Optional values: "Alloy", "echo", "fable", "onyx", "nova", "shimmer" alloy
response_format Audio format Optional values: "mp3", "opus", "aac", "flac", "wav", "pcm" mp3
speed Audio speed range is: 0.25 to 4.0. Supported by MaaS_Op_tts (Text To Speech) 1

Response

File Stream

Request Example

Request

MaaS_Az_tts

curl --location --request POST ' https://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/audio/speech' \
--header 'Authorization: Bearer ${your ak}' \
--header 'Content-Type: application/json' \
--header 'Connection: keep-alive' \
--data-raw '{

    "input":"<speak version='\''1.0'\'' xml:lang='\''en-US'\''><voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-AvaMultilingualNeural'\''>吃葡萄不吐葡萄皮</voice></speak>",

    "response_format":"audio-16khz-128kbitrate-mono-mp3"

}'

MaaS_Op_tts

curl 'http://genaiapi-m2.cloudsway.net/v1/audio/speech' \
-H 'Authorization: Bearer {Your_AK}' \
-H 'Content-Type: application/json' \
-d '{
    "input":"hi,what is your name?",
    "voice":"alloy",
    "speed":1.0,
    "response_format":"mp3"
}'

Response

file

Text To Speech HTTP Streaming Interface (MaaS_Az_tts only)

Request URL

POST https://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/audio/speech/stream

Request Parameters

Parameter Description Example
model Use Model MaaS ASpeech
input Text (in SSML format) for which audio needs to be generated \\test\\
response_format "mp3", "opus", "aac", "flac", "wav", "pcm" (Streaming): amr-wb-16000hz audio-16khz-32kbitrate-mono-mp3 audio-16khz-64kbitrate-mono-mp3 audio-16khz-128kbitrate-mono-mp3 audio-24khz-48kbitrate-mono-mp3 audio-24khz-96kbitrate-mono-mp3 audio-24khz-160kbitrate-mono-mp3 audio-48khz-96kbitrate-mono-mp3 audio-48khz-192kbitrate-mono-mp3 g722-16khz-64kbps ogg-16khz-16bit-mono-opus ogg-24khz-16bit-mono-opus ogg-48khz-16bit-mono-opus raw-8khz-8bit-mono-alaw raw-8khz-8bit-mono-mulaw raw-8khz-16bit-mono-pcm raw-16khz-16bit-mono-pcm raw-16khz-16bit-mono-truesilk raw-22050hz-16bit-mono-pcm raw-24khz-16bit-mono-pcm raw-24khz-16bit-mono-truesilk raw-44100hz-16bit-mono-pcm raw-48khz-16bit-mono-pcm webm-16khz-16bit-mono-opus webm-24khz-16bit-24kbps-mono-opus webm-24khz-16bit-mono-opus 可选值(NonStreaming): riff-8khz-8bit-mono-alaw riff-8khz-8bit-mono-mulaw riff-8khz-16bit-mono-pcm riff-22050hz-16bit-mono-pcm riff-24khz-16bit-mono-pcm riff-44100hz-16bit-mono-pcm riff-48khz-16bit-mono-pcm audio-16khz-32kbitrate-mono-mp3

Request Example

curl --location --request POST 'http://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/audio/speech/stream'
--header 'Authorization: Bearer ${your ak}' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw '{

    "input":"<speak version='\''1.0'\'' xml:lang='\''en-US'\''><voice xml:lang='\''en-US'\'' xml:gender='\''Female'\'' name='\''en-US-AvaMultilingualNeural'\''>吃葡萄不吐葡萄皮</voice></speak>",

    "response_format":"audio-16khz-32kbitrate-mono-mp3"

}'

Precautions

This HTTP request uses SSML to specify the voice and language. If the request body is too long, causing the generated audio to exceed 10 minutes, an error will be intercepted. It is recommended to split the text and resubmit the request.

Get the regional voice list of MaaS_Az_tts

Request URL

POST https://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/cognitiveservices/voices/list

Request Parameters

None

Response

Parameter Description Example
Name Full name of voice Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)
DisplayName Display Name Adri
LocalName Local Name Adri
ShortName Abbreviation af-ZA-AdriNeural
Gender Voice Gender Female
Locale Language Environment af-ZA
LocaleName Locale Name Afrikaans (South Africa)
SampleRateHertz Sampling Hertz 48000
VoiceType Voice Type Neural
Status Status GA
WordsPerMinute Words read per minute 147

Request Example

Request

curl --location --request GET 'http://genaiapi-m2.cloudsway.net/v1/ai/${ENDPOINT_PATH}/cognitiveservices/voices/list' \
--header 'Authorization: Bearer ${your ak}' \
--header 'Content-Type: application/json' \
--header 'Connection: keep-alive' \
--data-raw ''

Response

[
    {
        "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",
        "VoiceTag": {
            "ModelSeries": [
                "Monolingual"
            ],
            "Source": [
                "Azure"
            ],
            "TailoredScenarios": [
                "Assistant",
                "Narration"
            ],
            "VoicePersonalities": [
                "Well-Rounded",
                "Animated",
                "Bright"
            ]
        },
        "WordsPerMinute": "147"
    },
......
]

Integrated Interface Call

Note that the parameters of the fusion interface are the same as those of the non-fusion interface, but the model field is required, and the model product code should be passed in.

Request URL

POST https://genaiapi-m2.cloudsway.net/v1/audio/speech

MaaS_Az_tts

Request Example

curl 'http://genaiapi-m2.cloudsway.net/v1/audio/speech' \
-H 'Authorization: Bearer {Your_AK}' \
-H 'Content-Type: application/json' \
-d '{
    "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",
    "model": "MaaS_Az_tts"
}'

MaaS_Op_tts

Request Example

curl 'http://genaiapi-m2.cloudsway.net/v1/audio/speech' \
-H 'Authorization: Bearer {Your_AK}' \
-H 'Content-Type: application/json' \
-d '{
    "input":"hi,what is your name?",
    "voice":"alloy",
    "speed":1.0,
    "response_format":"mp3",
    "model": "MaaS_Op_tts"
}'