Skip to main content

Usage guide

Setup, environment variables, and Python/JavaScript/Go usage examples.

XAIRealtime

Speech-to-speech conversation with xAI’s Grok voice models, using your own xAI API key. Choose it when you want one model to listen, reason and speak with minimal latency. Authenticates with XAI_API_KEY from your environment, or an explicit api_key.

Fields

str
default:"UNSET"
Grok voice model name, e.g. “grok-voice-think-fast-2.0”. Defaults to ‘grok-voice-think-fast-2.0’.
Mapping[str, Any] | None
default:"UNSET"
Session settings such as voice, instructions and reasoning effort (“none” or “high”), passed as a dict. Defaults to None (not set).
str | None
default:"UNSET"
Custom endpoint URL for the xAI realtime API. Leave unset to use xAI’s standard endpoint. Defaults to None (not set).