Skip to main content

xAI STT plugin guide

How to use the xAI STT plugin for LiveKit Agents.

Available in
Python
|
Node.js

Overview

This plugin allows you to use xAI as an STT provider for your voice agents.

Quick reference

This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.

Installation

Install the plugin from PyPI:

uv add "livekit-agents[xai]~=1.5"
pnpm add @livekit/agents-plugin-xai

Authentication

The xAI plugin requires an xAI API key.

Set XAI_API_KEY in your .env file.

Usage

Use xAI STT in an AgentSession or as a standalone transcription service. For example, you can use this STT in the Voice AI quickstart.

from livekit.plugins import xai
session = AgentSession(
stt = xai.STT(),
# ... llm, tts, etc.
)
import * as xai from '@livekit/agents-plugin-xai';
const session = new voice.AgentSession({
stt: new xai.STT(
language="en"
),
// ... llm, tts, etc.
});

Parameters

This section describes some of the available parameters. See the plugin reference links in the Additional resources section for a complete list of all available parameters.

api_key
Required
strEnv: XAI_API_KEY

xAI API key.

enable_interim_resultsboolDefault: True

Whether to return interim (non-final) transcription results.

Additional resources

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