Generate speech
Generates audio from text using the TTS REST endpoint.
Generates audio from text using the TTS REST endpoint.
Headers
AuthorizationRequiredBearer <SONIOX_API_KEY>Request
application/jsonRequiredmodelRequiredstringTTS model to use.
"tts-rt-v1"languageRequiredstringLanguage code of the input text.
voiceRequiredstringVoice to use: a built-in voice name (for example Adrian) or the ID of a cloned voice.
audio_formatRequiredstringOutput audio format (for example mp3, wav, pcm_s16le, pcm_s16be).
textRequiredstringInput text to generate audio from.
sample_rateintegerOptional output sample rate in Hz.
bitrateintegerOptional output bitrate in bits per second.
client_reference_idstringOptional tracking identifier string. Does not need to be unique. Ignored if the request authenticates with a temporary API key.
256speednumberOptional speaking rate of the generated speech, from 0.7 to 1.3. 1.0 is the normal speed; lower values slow speech down and higher values speed it up. Defaults to 1.0.
reduce_silencebooleanOptional. When true, shortens the pauses between words so the generated speech flows more naturally. Defaults to false. Only supported on models with supports_silence_reduction set to true; enabling it on any other model returns an invalid_request error.
Header parameters
X-Request-IdstringOptional request ID for tracing.
Response
200
Generated audio stream.
Response body contains raw audio bytes.
responseRequiredstring"binary"Errors
Generated audio stream.
Response body contains raw audio bytes.
"string"