xAI TTS V1

Usage-based pricing
ae_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.

TTSAudio
Usage-based pricing

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.

ParameterTypeRequiredDescriptionDefault
request_bodyobjectYesNo parameter description.—
request_body.textstringYesThe 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.voiceenum (eve | ara | rex | sal | leo)NoVoice to use for synthesis. eve: energetic, upbeat. ara: warm, friendly. rex: confident, clear. sal: smooth, balanced. leo: authoritative, strong.eve
request_body.languageenum (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)NoBCP-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_formatobjectNoOutput format configuration for the TTS API.—
request_body.output_format.codecenum (mp3 | wav | pcm | mulaw | alaw)NoAudio codec. Supported: mp3, wav, pcm, mulaw, alaw.mp3
request_body.output_format.bit_rateinteger | unknownNoBit rate in bps. Only applicable for MP3 codec. Defaults to 128000 for MP3.—
request_body.output_format.sample_rateenum (8000 | 16000 | 22050 | 24000 | 44100 | 48000)NoSample rate in Hz.24000

Invocation example

Copy the request and explore its response example.

POST/agent-api/v1/tool/executeX-Api-Key

Submit first, then query with the returned task_id until the task completes.

Request coderequest.sh
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"
    }
  }
}'
Response exampleresponse.json
JSON
{
  "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