Skip to main content
POST
xAI TTS 1
  1. After submission, a task_id will be returned. If you provided a callback_url, when the task status becomes finished or failed, a POST request will be sent to the callback_url.
  2. Regardless of whether callback_url is provided, you can retrieve the result through the unified Query Task Status endpoint.
Convert text into speech with xAI TTS, choosing from five voices and multiple languages for narration, dialogue, and spoken content.

Models

  • xai/tts/v1 - Convert text into speech.

Features

  • Convert text into speech.
  • Select a voice with voice and specify the spoken language with language_code.
  • Direct pauses, laughter, sighs, whispers, and slower phrases through tags in text.

Output Options

Output Format

  • output_format: Optional. Supply an object with the fields below.
  • output_format.codec: Optional. Accepted values: mp3, wav, pcm, mulaw, alaw. Default: mp3.
  • output_format.sample_rate: Optional. Sample rate in Hz. Accepted values: 8000, 16000, 22050, 24000, 44100, 48000. Default: 24000.
  • output_format.bit_rate: Optional. MP3 bitrate in bits per second. Accepted values: 32000, 64000, 96000, 128000, 192000, null. MP3 default: 128000.
  • For mp3, use output_format.bit_rate to select the bitrate. For wav, pcm, mulaw, and alaw, omit bit_rate or set it to null.

Advanced Parameters

Set model and optional callback_url at the request root. Place all workflow parameters, including output options, inside input.

Text

  • text: Required. Supply the text to speak. Length: 1-15,000 characters.
  • Enter spoken text after trimming leading and trailing whitespace. Tags, punctuation, and spaces within the text count toward the length.
  • Add [laugh], [pause], or [sigh] where the sound belongs. Use <whisper>text</whisper> for whispered passages and <slow>text</slow> for slower delivery.

Voice

  • voice: Optional. Select the voice. Accepted values: eve, ara, rex, sal, leo. Default: eve.

Language Code

  • language_code: Optional. String. Default: auto.
  • auto
  • en
  • ar-EG
  • ar-SA
  • ar-AE
  • bn
  • zh
  • fr
  • de
  • hi
  • id
  • it
  • ja
  • ko
  • pt-BR
  • pt-PT
  • ru
  • es-MX
  • es-ES
  • tr
  • vi

Output Files

  • Read every item in the returned files array.
  • Generated audio uses file_type: "audio".
  • Use file_url to download the generated speech.

Request Example

Authorizations

Authorization
string
header
required

Use VIDGO_API_KEY.

Body

application/json

Place model and callback_url at the root. Put text, voice, language_code, and output_format inside input.

model
enum<string>
required
Available options:
xai/tts/v1
Example:

"xai/tts/v1"

input
object
required
callback_url
string | null

Provide a public HTTP(S) callback_url to receive task completion notifications. HTTPS is recommended.

Response

Task submitted

code
enum<integer>
required
Available options:
200
data
object
required