xAI TTS V1
Convert text into natural spoken audio in supported languages. Choose a voice, add expressive cues such as pauses or whispers, and select the audio format and quality.
Pricing
The charge per call is (max(18 × Input text characters, 0)) AE credits. All applicable conditions are combined to calculate the total.
Charges are based on the number of input text characters. Charges apply only to successful speech generation; service errors and queue waiting are not charged. The same rate applies across all currently supported voices, languages, speech tags, and output formats.
Parameters
Optional parameters use the platform defaults when omitted.
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
request_body | object | Yes | No parameter description. | — |
request_body.text | string | Yes | The text to convert to speech. Maximum 15,000 characters. Supports speech tags for expressive delivery: inline tags like [laugh], [pause], [sigh] and wrapping tags like <whisper>text</whisper>, <slow>text</slow>. | — |
request_body.voice | enum (eve | ara | rex | sal | leo) | No | Voice to use for synthesis. eve: energetic, upbeat. ara: warm, friendly. rex: confident, clear. sal: smooth, balanced. leo: authoritative, strong. | eve |
request_body.language | enum (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) | No | BCP-47 language code or 'auto' for automatic detection. Supported: en, zh, fr, de, hi, id, it, ja, ko, pt-BR, pt-PT, ru, es-MX, es-ES, tr, vi, bn, ar-EG, ar-SA, ar-AE. | auto |
request_body.output_format | object | No | Output format configuration for the TTS API. | — |
request_body.output_format.codec | enum (mp3 | wav | pcm | mulaw | alaw) | No | Audio codec. Supported: mp3, wav, pcm, mulaw, alaw. | mp3 |
request_body.output_format.bit_rate | integer | unknown | No | Bit rate in bps. Only applicable for MP3 codec. Defaults to 128000 for MP3. | — |
request_body.output_format.sample_rate | enum (8000 | 16000 | 22050 | 24000 | 44100 | 48000) | No | Sample rate in Hz. | 24000 |
Invocation example
Copy the request and explore its response example.
/agent-api/v1/tool/executeX-Api-KeySubmit first, then query with the returned task_id until the task completes.
curl --request POST \
--url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_xai_tts_v1' \
--header "X-Api-Key: $AGENTEARTH_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"params": {
"request_body": {
"language": "zh",
"output_format": {
"bit_rate": 128000,
"codec": "mp3",
"sample_rate": 44100
},
"text": "三个盒子都挂在我主页。想要哪个私信,我拿手机拍给你看,图我懒得修。",
"voice": "ara"
}
}
}'{
"description": "task accepted; poll the result via query_tool with this task_id",
"query_tool": "ae_get_result",
"status": "created",
"task_id": "fab9418b-47f2-4775-bc9a-cef1f86c69ce"
}Guides using this tool
See how this tool fits into real workflows





