LiveKit docs › Partner spotlight › xAI › xAI TTS

---

# xAI TTS

> How to use xAI TTS with LiveKit Agents.

- **[Use in Agent Builder](https://cloud.livekit.io/projects/p_/agents/builder/new?tts=xai%2Ftts-1)**: Create a new agent in your browser using xai/tts-1

## Overview

xAI TTS is available in LiveKit Agents through [LiveKit Inference](https://docs.livekit.io/agents/models/inference.md) and the [xAI plugin](#plugin). With LiveKit Inference, your agent runs on LiveKit's infrastructure to minimize latency. No separate provider API key is required, and usage and rate limits are managed through LiveKit Cloud. Use the plugin instead if you want to manage your own billing and rate limits. Pricing for LiveKit Inference is available on the [pricing page](https://livekit.com/pricing/inference#tts).

## LiveKit Inference

Use [LiveKit Inference](https://docs.livekit.io/agents/models/inference.md) to access xAI TTS without a separate xAI API key.

| Model ID | Languages |
| -------- | --------- |
| `xai/tts-1` | `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` |

### Usage

To use xAI, use the `TTS` class from the `inference` module:

**Python**:

```python
from livekit.agents import AgentSession, inference

session = AgentSession(
    tts=inference.TTS(
        model="xai/tts-1", 
        voice="ara", 
        language="en"
    ),
    # ... stt, llm, vad, turn_handling, etc.
)

```

---

**Node.js**:

```typescript
import { AgentSession, inference } from '@livekit/agents';
const session = new AgentSession({
    tts: new inference.TTS({
        model: "xai/tts-1",
        voice: "ara",
    }),
    // ... stt, llm, vad, turnHandling, etc.
});

```

### Parameters

- **`model`** _(string)_: The model ID from the [models list](#inference).

- **`voice`** _(string)_: The voice ID used for speech generation. For guidance on selecting a voice, see [voices](#voices).

- **`language`** _(string)_ (optional): Language code for the input text. If not set, the model default applies.

### Voices

The following is a sample of the xAI voices available in LiveKit Inference. For a complete list of voices, see the [xAI TTS documentation](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech).

| Provider | Name | Description | Language | ID |
| -------- | ---- | ----------- | -------- | -------- |
| xAI | Ara | Warm, friendly | `en-US` | `xai/tts-1:ara` |
| xAI | Eve | Energetic, upbeat | `en-US` | `xai/tts-1:eve` |
| xAI | Leo | Authoritative, strong | `en-US` | `xai/tts-1:leo` |
| xAI | Rex | Confident, clear | `en-US` | `xai/tts-1:rex` |

### String descriptors

As a shortcut, you can also pass a descriptor with the [model ID](#inference) and voice directly to the `tts` argument in your `AgentSession`:

**Python**:

```python
from livekit.agents import AgentSession

session = AgentSession(
    tts="xai/tts-1:ara",
    # ... llm, stt, vad, turn_handling, etc.
)

```

---

**Node.js**:

```typescript
import { AgentSession } from '@livekit/agents';

session = new AgentSession({
    tts: "xai/tts-1:ara",
    // ... llm, stt, vad, turnHandling, etc.
});

```

## Plugin

Use the xAI plugin to connect directly to xAI's TTS API with your own API key. For Node.js, use [LiveKit Inference](#inference) instead.

Available in:
- [ ] Node.js
- [x] Python

### Installation

Install the plugin from PyPI:

```shell
uv add "livekit-agents[xai]~=1.5"

```

### Authentication

The xAI plugin requires an [xAI API key](https://console.x.ai/).

Set `XAI_API_KEY` in your `.env` file.

### Usage

Use xAI TTS in an `AgentSession` or as a standalone speech generator. For example, you can use this TTS in the [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md).

**Python**:

```python
from livekit.plugins import xai

session = AgentSession(
  tts = xai.TTS(
    voice="ara",
  ),
  # ... llm, stt, etc.
)

```

### Parameters

This section describes some of the available parameters. See the plugin reference links in the [Additional resources](#additional-resources) section for a complete list of all available parameters.

- **`voice`** _(GrokVoices | string)_ (optional) - Default: `ara`: The voice ID used for speech generation.

## Speech tags

xAI TTS supports speech tags that add expressive delivery to synthesized speech. There are two categories of tags:

- **Inline tags** insert a vocal expression at a specific point in the text. For example, a `[pause]` tag can create a short pause, while a `[laugh]` tag can add laughter.
- **Wrapping tags** modify how a section of text is delivered. For example, `<whisper>a secret</whisper>` delivers the text in a whispered voice, while `<slow>text</slow>` is spoken at a slower pace.

Tags can be combined for layered effects:

```markdown
So I walked in and [pause] there it was. [laugh]

I need to tell you something. <whisper>It is a secret.</whisper>

<slow><soft>Goodnight, sleep well.</soft></slow>

```

For a complete list of tags and examples, see the [xAI speech tags documentation](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech#speech-tags).

## Voice realism

For prompting techniques that incorporate the [speech tags](#speech-tags) above into your agent's responses for more natural-sounding speech, see [Voice realism](https://docs.livekit.io/agents/start/prompting.md#voice-realism) in the prompting guide.

## Additional resources

The following resources provide more information about using xAI with LiveKit Agents.

- **[xAI docs](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech)**: xAI TTS docs.

- **[Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai.md)**: Get started with LiveKit Agents and xAI TTS.

---

This document was rendered at 2026-06-07T11:36:45.780Z.
For the latest version of this document, see [https://docs.livekit.io/agents/models/tts/xai.md](https://docs.livekit.io/agents/models/tts/xai.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).