Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
XAISTT
Streaming speech-to-text with xAI, using your own xAI API key. Supports interim results, speaker diarization and multichannel audio. Authenticates with XAI_API_KEY from your environment, or an explicitapi_key.
Fields
Sample rate of incoming audio in Hz: 8000, 16000, 22050, 24000, 44100 or 48000. Leave unset to detect it automatically. Defaults to None (not set).
Encoding of incoming audio: “pcm” (16-bit linear), “mulaw” or “alaw”. Defaults to ‘pcm’.
Emit partial transcripts while the user is still speaking, before the final result. Defaults to True.
Milliseconds of silence before an utterance is finalized, 0 to 5000. Keep it low for fast turn-taking. Defaults to 50.
BCP-47 language code, e.g. “en” or “fr”. Any supported language is transcribed; this enables written-form numbers and currencies. Defaults to ‘en’.
Transcribe each audio channel separately instead of mixing down to mono. Defaults to False.
Number of audio channels to transcribe when multichannel is on, 2 to 8. Ignored otherwise. Defaults to 2.
WebSocket URL of the xAI speech-to-text endpoint. Defaults to ‘wss://api.x.ai/v1/stt’.