xAI has introduced a new Speech-to-Text (STT) API, accessible via a REST endpoint at /v1/stt. This API supports real-time streaming speech-to-text functionality through WebSockets, allowing raw audio to be processed as binary frames and returning JSON transcript events as the audio is processed. Configuration for this real-time processing is managed through query parameters at the time of connection.
The API provides a full transcript, including merged text for multichannel requests with interleaved words by timestamp. It also detects language using BCP-47 codes, provides audio duration, and offers word-level segments with timestamps. For multichannel audio, per-channel transcripts are available when multichannel=true.
Key Points
- The xAI Speech-to-Text API is available via a REST endpoint at
/v1/stt. - Real-time streaming speech-to-text is supported through WebSockets, processing raw audio as binary frames.
- The API detects language using BCP-47 codes (e.g.,
en,es-mx) and provides audio duration. - Supported audio sample rates include 8000, 16000, 22050, 24000, 44100, and 48000 Hz.
- Audio encoding formats supported are PCM, mulaw, alaw, and Opus.
- Features include speaker diarization, inverse text normalization, and keyterm biasing.
- Smart Turn end-of-turn detection can be enabled with a confidence threshold between 0.0 and 1.0.
Context
According to xAI, the Speech-to-Text API allows developers to integrate advanced audio transcription capabilities into their applications. The API offers various configuration options, such as enabling partial transcript events approximately every 500 ms and setting silence duration before a speech_final=true event. It also supports filtering and sorting for collections and documents, as described in the xAI Collections API documentation.
Why It Matters
This API provides developers with tools for building applications that require accurate and real-time audio transcription, including features that enhance the clarity and structure of transcribed content. The ability to bias transcription with key terms and detect speaker turns can improve the utility of voice-enabled interfaces and analytical tools.
What To Do
- Review the xAI Speech-to-Text API documentation for detailed endpoint specifications and parameter options.
- Test the real-time streaming functionality using WebSockets with different audio encodings and sample rates.
- Experiment with features like speaker diarization and inverse text normalization to evaluate their impact on transcription quality.
- Compare the
smart_turnandsmart_turn_timeoutparameters to optimize end-of-turn detection for specific use cases.
