POST /v1/speech · Synthesize speech
Convert text to speech and return the complete audio file in the response body.
text(required): Text to synthesize. Maximum 5,000 characters for POST /v1/speech and 20,000 characters for POST /v1/speech/stream. Longer text is rejected with 422.voice_id: Voice to synthesize with, from GET /v1/voices. Omit to use the default platform voice. An unrecognized value is not rejected: the default voice is used and X-Voice-Fallback is set to true on the response.language: Language of the input text. Panini detects the language automatically, so auto is the default and the recommended value. Other values are accepted but have no effect.speed: Speaking rate multiplier. Values outside 0.5 to 2.0 are clamped to that range rather than rejected.output_format: Audio format of the response. opus is Opus in an Ogg container and is typically 10 to 20 times smaller than wav for the same speech. Ignored by POST /v1/speech/stream, which always returns WAV/PCM.sample_rate: Output sample rate in Hz. Defaults to 24000. Use 8000 or 16000 for telephony and speech-recognition pipelines. Unsupported values fall back to the default.
{
"text": "Hello, welcome to Sonex Labs.",
"voice_id": "9b8fsavyez",
"output_format": "mp3"
}