Skip to content

xAI Text to Speech

Integrate

Model id xai/tts/v1
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

This request: $0.001 1 API credit Run it on this page

Get API key

Text-to-speech with built-in voices, language selection and inline expressive speech tags

xAI · Audio

Your first result goes here

Build a request below and run it with your API key. Outputs are copied to our storage, kept forever or 7 days for free.

Build a request

Controls are generated from the model schema. The code and the price update as you change them.

•required 50 / 15000

Speech-synthesis text, with expressive delivery controlled through inline tags ([laugh], [pause], [sigh]) or wrapping tags (<whisper>text</whisper>, <slow>text</slow>). The input cannot exceed 15,000 characters.

Advanced voice · language · enable_safety_checker · output_format
default eve

Built-in voice selected for speech synthesis.

default auto

Language selection from these BCP-47 codes: 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. For automatic detection instead, supply 'auto'.

Configuration for the generated audio format; the default is MP3 with a 24 kHz sample rate and 128 kbps bitrate.

POST /run/xai/tts/v1?wait=20 quote → $0.001
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

Run this request

Your key stays in this browser: it is sent only to the Doitong API and saved (localStorage) only if you tick Remember. Get an API key

About xAI Text to Speech

Converts up to 15,000 characters of text to speech. Choose from 28 built-in voices and a language code or automatic detection. The text can include tags like [laugh], [pause] and [sigh], or wrapping tags such as <whisper> and <slow>, for expressive delivery. `output_format` configures the audio file.

Parameters

NameType DefaultAllowed Description
textrequired
Typestring
≤ 15,000 characters
Speech-synthesis text, with expressive delivery controlled through inline tags ([laugh], [pause], [sigh]) or wrapping tags (<whisper>text</whisper>, <slow>text</slow>). The input cannot exceed 15,000 characters.
voiceoptional
Typeenum
Defaulteve
carinazaganhelixorionlunairisaltairzenithperseusheliosluxkeplerrigelcosmocelesteursa
+12 moresiriuslumencastornakshatlasauroralioraaraeveleorexsal
Built-in voice selected for speech synthesis.
languageoptional
Typeenum
Defaultauto
autoenar-EGar-SAar-AEbnzhfrdehiiditjakopt-BRpt-PT
+5 morerues-MXes-EStrvi
Language selection from these BCP-47 codes: 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. For automatic detection instead, supply 'auto'.
output_formatoptional
Typeobject
Configuration for the generated audio format; the default is MP3 with a 24 kHz sample rate and 128 kbps bitrate.
output_format.codecoptional
Typeenum
Defaultmp3
mp3wavpcmmulawalaw
Codec for audio encoding; available choices are mp3, wav, pcm, mulaw, alaw.
output_format.sample_rateoptional
Typeenum
Default24000
80001600022050240004410048000
Audio sampling frequency, measured in Hz.
output_format.bit_rateoptional
Typeenum
320006400096000128000192000
Bit rate for MP3 output, defaulting to 128000 and measured in bps; it does not apply to other codecs.
enable_safety_checkeroptional
Typeboolean
Defaulttrue
Screening can be relaxed by setting false, provided the caller is authorized.
required

Output

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "xai/tts/v1",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 1,
    "usd": "0.001",
    "charged": 1,
    "refunded": 0
  },
  "input": {
    "text": "Hello from Doitong. This is a short test sentence."
  },
  "output": {
    "audio": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_name": "0-output.mp3",
      "file_size": 1843200
    }
  },
  "outputs": [
    {
      "type": "audio",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_size": 1843200,
      "duration": 12,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
Your files, your choiceEvery outputs[].url is a copy on our storage: kept forever (paid per GB-month) or 7 days for free, by your account setting or ?storage=.
Same shape on every modeltype, url, content_type, width, height and duration, for images, video and audio alike. output is the model’s own result object.
Fields of output
audio
object {url, content_type, file_name, file_size}Audio file produced by generation.

For AI agents: this page as Markdown is at https://doitong.com/developers/models/xai/tts/v1.md. All models and guides: https://doitong.com/developers/llms.txt