In short.
Live Interpreter is an xAI tutorial for developers building a two-language voice interpreter, but its demo needs authenticated session access before public deployment. It covers browser audio streaming, short-lived credentials, captions and a terminal example. The page quotes $0.08 per minute and reports speech beginning 0.7 to 1 second after the speaker stops. Those are source-reported figures; current prices, actual performance and translation accuracy remain unverified.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage is the complete documentation page at [https://docs.x.ai/cookbook/examples/live-interpreter.md]. It includes the page's cautions about unrestricted credential issuance, paused microphone input, billed silence and connection retries. The linked prompting guide, repository files, and separate pricing, licence and service-term pages are excluded. No code or API session was executed; actual translation quality, audio behavior, latency, reliability and charges remain unverified.
The overview
Identity
Live Interpreter is a cookbook recipe in xAI's documentation at [https://docs.x.ai/cookbook/examples/live-interpreter.md]. It explains a TypeScript and browser JavaScript example that translates spoken turns between two languages through Grok's realtime voice API. The selected page describes implementation files but does not supply their complete contents.
Assessment
Its strongest teaching point is keeping the long-lived API key on the server while allowing the browser to stream audio directly to xAI. It also explains connection sequencing, playback scheduling and transcript handling. It is useful as a prototype reference, but the documented session endpoint allows anyone who can reach it to create billable sessions until access controls are added.
Users
The recipe suits developers learning browser voice integration or adding spoken translation to an application. Beginners get concrete commands and an explanation of the conversation flow, although JavaScript, environment variables and server basics would help. Experienced developers get details about WebSocket authentication, PCM audio, session events and turn handling.
Capabilities
The browser interface lets users choose a source and target language, translate microphone speech and see captions for both sides. The documented example translates English into Spanish; a terminal command demonstrates French output. A complete supported-language list is not provided.
The terminal mode generates source speech with text-to-speech, streams it into the interpreter, prints transcripts and saves translated audio to output/translation.wav. The page also describes displaying session duration and estimated cost.
Using it
Requirements
The page requires Node.js 22.13 or later, an xAI API key supplied through XAI_API_KEY, and the example repository. Browser mode needs a microphone and support for WebSocket, AudioWorklet and Web Audio features. Specific supported browsers are not listed.
Terminal mode does not need a microphone because client.voice.speak() generates the input audio. The page says the SDK is the example's only package dependency; an exact SDK version is not specified.
Mechanism
The server calls client.voice.clientSecrets.create() to obtain a token configured for grok-voice-think-fast-2.0 with reasoning disabled. Each token can open one session and expires after 60 seconds, but an established session continues after token expiry.
The browser opens [wss://api.x.ai/v1/realtime] using the xai-client-secret.<token> WebSocket subprotocol. After session.created, it sends session.update with the translation prompt, voice, server-side turn detection, 24 kHz PCM input and output, and grok-transcribe. It waits for session.updated to confirm the prompt before sending microphone audio; an earlier settings event can lack the prompt.
Microphone audio travels in 100 ms base64 PCM chunks through input_audio_buffer.append. Transcript events update the captions, and incoming audio chunks are scheduled consecutively for playback. The page uses a raw WebSocket because the SDK described there has no realtime client.
Setup
From a checkout containing the example, enter examples/live-interpreter/typescript, supply XAI_API_KEY through a repository-root .env file or the environment, run npm install, and then run npm run web. Open [http://localhost:3000], choose the two languages and start the microphone.
The page references the example repository but does not provide a checkout address in the supplied text. Its server serves the interface and issues credentials through POST /api/session.
Example
In the documented browser flow, a person speaks English, pauses, and hears Spanish while captions appear beside the source transcript. The microphone stays paused until translated playback finishes, plus another 0.3 seconds.
The documented command npm start -- --to fr "Where can I buy a ticket for tonight's concert?" demonstrates terminal translation into French. It uses generated source speech and is described as saving the translated audio to output/translation.wav. These are documented examples, not observed execution results.
Assessment & evidence
Limitations
The interface requires turn-taking: speech during translated playback is not sent to the API. Brief pauses can also end a turn prematurely. The page describes reusing a caption row when resumed speech causes an uncommitted turn to be dropped.
The author reports that roughly one connection in ten opened without starting a session. The example waits five seconds for session.created and retries with fresh tokens, allowing up to three attempts. Those observations do not establish a general failure rate.
Translation accuracy, language coverage, noisy-room performance, accent handling and browser compatibility are not measured in the supplied page. The reported 0.7 to 1 second speech-onset delay lacks a detailed test method or sample size.
Reasoning
The author disables model reasoning on the premise that translation does not require it, and reports similar speech-onset latency with reasoning enabled or disabled. No translation-quality comparison is supplied.
The prompt directs the conversational voice model to translate questions and instruction-like speech rather than answer or obey them. This explains the intended interpreter behavior; consistent adherence under difficult inputs is not demonstrated.
Alternatives
The recipe offers browser microphone mode for interactive use and terminal mode for scripted input using generated speech. It does not compare competing translation services, local models or separate transcription-and-translation pipelines. Relative accuracy, latency, privacy and cost across those approaches are therefore unknown.
Evidence
The evidence consists of the complete xAI documentation page, including its setup commands, architecture explanation, API identifiers and author-reported observations. The named implementation files are described rather than supplied in full. The page contains no translation-quality benchmark, independent performance measurements or detailed method supporting its latency, connection reliability and billing observations.
Access & freshness
Costs
The page states a speech-to-speech price of $0.08 per minute, equivalent to $4.80 per hour. It describes a short terminal example as costing about one cent. These figures are source-reported and have not been confirmed against current pricing.
According to the author's observations, usage.billable_audio_seconds in response.done tracks elapsed time from the first audio arrival, including silence. Token expiry does not end an established session, so stopping the session matters for cost control. Any separate charge for terminal text-to-speech generation and hosting is not specified.
Rights
The supplied page contains no licence or explicit permission to redistribute its documentation or example code. Commercial reuse rights, translated-output terms, and audio storage or retention rules are not established. Review the applicable repository licence and xAI service terms before reuse or deployment; public documentation alone does not establish those permissions.
Freshness
The supplied page was captured on 14 November 2026 at 21:12:46.443 UTC. No publication or last-updated date is given. It names grok-voice-think-fast-2.0, grok-transcribe and Node.js 22.13 or later. Current model availability, SDK compatibility, prices and subsequent API changes have not been verified.
Actions
For a local trial, obtain the referenced example files and follow the documented Node.js setup. Before exposing the server publicly, restrict POST /api/session to authenticated users and keep the long-lived API key on the server.
Before adopting the design, evaluate the intended language pairs against known translations, check pauses and speech during playback, and examine startup failures. Confirm current prices and reuse terms, inspect reported billable seconds, and stop sessions when finished.
