v1

latestOpenAPI 3.0.02026-07-26152942.8 KB
text_to_speech

Convert text to speech

Convert text to speech using the specified voice

post/v1/text-to-speech/{voice_id}

Path parameters

voice_idstring required

Request body

textstring required

The text to convert to speech

language'en' | 'ko' | 'ja' | 'bg' | 'cs' | 'da' | 'el' | 'es' | 'et' | 'fi' | 'hu' | 'it' | 'nl' | 'pl' | 'pt' | 'ro' | 'ar' | 'de' | 'fr' | 'hi' | 'id' | 'ru' | 'vi' | 'hr' | 'lt' | 'lv' | 'sk' | 'sl' | 'sv' | 'tr' | 'uk' required

The language code of the text

stylestring

The style of character to use for the text-to-speech conversion

model'sona_speech_1' | 'sona_speech_2' | 'sona_speech_2_flash' | 'supertonic_api_1' | 'supertonic_api_3'

The model type to use for the text-to-speech conversion

output_format'wav' | 'mp3'

The desired output format of the audio file (wav, mp3). Default is wav.

include_phonemesboolean

Return phoneme timing data with the audio

normalized_textstring

Pre-normalized text for TTS. Only used with sona_speech_2 and sona_speech_2_flash models.

Response

Returns either binary audio or JSON with phoneme data based on include_phonemes parameter

audio_base64string required

Base64 encoded audio data

Example response

{
  "audio_base64": "UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhY...",
  "phonemes": {
    "symbols": [
      "",
      "h",
      "ɐ",
      "ɡ",
      "ʌ",
      ""
    ],
    "start_times_seconds": [
      0,
      0.092,
      0.197,
      0.255,
      0.29,
      0.58
    ],
    "durations_seconds": [
      0.092,
      0.104,
      0.058,
      0.034,
      0.29,
      0.162
    ]
  }
}