Skip to content

MaaS ASpeech/OSpeech

Request Method:

POST

Request Path:

{endpoint}/audio/speech

Request header

Parameter Description Example
Authorization AccessKey
Bearer ${AccessKey}
Bearer xxxxxx

Request Body

Parameter Description Example
model The model being used tts-1
input The text input that needs to be converted to audio how are you
voice The voice option available for audio generation
Possible values:
"alloy", "echo", "fable", "onyx", "nova", "shimmer"
alloy
response_format The audio format
Possible values: "mp3", "opus", "aac", "flac", "wav", "pcm"
mp3
speed The audio speed
a range of: 0.25 to 4.0.
1.0

Response Body

File stream

Sample Request

MaaS ASpeech

curl --location '{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 '{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"
}'

Get MaaS Aspeech Regional Language List

Request Method:

GET

Request Path:

{endpointPath}/cognitiveservices/voices/list

Request Header

Parameter Description Example
Authorization AccessKey
Bearer ${AccessKey}
Bearer xxxxxx

Return Parameters

Object Array

Object Parameters:

Parameter Description Example
Name Voice Full Name Microsoft Server Speech Text to Speech Voice (af-ZA, AdriNeural)
DisplayName Display Name Adri
LocalName Local Name Adri
ShortName Short Name af-ZA-AdriNeural
Gender Voice Gender Female
Locale Locale af-ZA
LocaleName Locale Language Name Afrikaans (South Africa)
SampleRateHertz Sampling Rate 48000
VoiceType Voice Type Neural
Status Status GA
WordsPerMinute Words Per Minute 147

Request Example

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