DEV Community

ZHIWEI
ZHIWEI

Posted on

Grok TTS speech tags, tested: what <loud>, <singing> and [laugh] actually do

xAI's Grok text to speech API (POST https://api.x.ai/v1/tts) has 28 built-in voices, 20 languages and a set of speech tags you put straight into the text. The docs list the tags; they don't say how much each one changes. I measured a couple.

The request

const res = await fetch('https://api.x.ai/v1/tts', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.XAI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Stand back. <loud>This is not a drill.</loud>',
    voice_id: 'eve',
    language: 'en',
    output_format: { codec: 'mp3', sample_rate: 24000, bit_rate: 128000 },
  }),
});
const mp3 = Buffer.from(await res.arrayBuffer());
Enter fullscreen mode Exit fullscreen mode

language also takes auto. Price is $15 per million characters (xAI pricing page, checked 2026-10-30).

Two kinds of tags

  • Inline tags insert a sound where they sit: [pause], [long-pause], [hum-tune], [laugh], [chuckle], [giggle], [cry], [tsk], [tongue-click], [lip-smack], [breath], [inhale], [exhale], [sigh].
  • Wrapping tags change how the enclosed phrase is read: <soft>, <whisper>, <loud>, <build-intensity>, <decrease-intensity>, <higher-pitch>, <lower-pitch>, <slow>, <fast>, <sing-song>, <singing>, <emphasis>.

What two of them measured

Same sentence, voice Eve, English, one clip with and one without the tag. One clip each, so this is a quick check rather than a benchmark.

Tag Length Loudness (RMS) Median pitch
none → <loud> 5.5 s → 5.5 s -20.7 → -20.9 dBFS 195 → 253 Hz
none → <singing> 6.5 s → 8.4 s — 189 → 250 Hz

So <loud> is closer to "raised, urgent delivery" than a volume control: if you need a louder file, normalise it afterwards. <singing> stretches the words into a melody, which also makes the clip longer (and, on a per-character price, not more expensive).

Trying tags without writing code

If you want to hear the tags on all 28 voices before wiring up the API, I built a free front-end: Grok Text to Speech. The speech tag reference has a before/after sample for each group, and there are preset pages for whisper, shouting and singing. It's an independent project, not affiliated with xAI.

Top comments (0)