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 xaisession = 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_keystrEnv: XAI_API_KEYxAI API key.
enable_interim_resultsboolDefault: TrueWhether to return interim (non-final) transcription results.
Additional resources
The following resources provide more information about using xAI with LiveKit Agents.