xAI: Grok Voice 2.0
xAI's previous-generation realtime speech-to-speech voice agent over WebSockets, with low-latency turn-taking and tool use such as web search.
Variant Models
These are native model IDs accepted by the author/provider for the same canonical model family.
Pinned Grok Voice 2.0 release, selected via the model query param on /v1/realtime.
Still accepted by /v1/realtime, which reports it as grok-voice-2.0.
Providers
Different providers can host the same model. Choose one provider when you need a fixed backend, or let routing select among them.
Supported languages
en
ar-EG
ar-SA
ar-AE
bn
zh
fr
de
hi
id
it
ja
ko
pt-BR
pt-PT
ru
es-MX
es-ES
tr
vi
Features
Bidirectional realtime speech-to-speech over WebSocket.
speech_to_speech
Natural conversational turn-taking.
turn_taking
Integrated tool calling (e.g. web search) during conversation.
tool_use
Optional transcription of input audio, biased by a language hint and key terms.
input_transcription
Reasoning can be turned off per session with reasoning.effort none.
reasoning_effort
Code
Realtime speech-to-speech with the OpenAI SDK
Sends question.pcm (24 kHz 16-bit mono PCM) as one turn over the OpenAI Realtime protocol and saves the spoken reply to reply.pcm.
import { once } from "node:events";
import { readFile, writeFile } from "node:fs/promises";
import OpenAI from "openai";
import { OpenAIRealtimeWS } from "openai/realtime/ws";
const client = new OpenAI({
apiKey: process.env.ALLMODELS_API_KEY,
baseURL: "https://api.allmodels.io/oai"
});
const realtime = new OpenAIRealtimeWS({ model: "grok-voice-2.0" }, client);
const reply = [];
realtime.on("response.output_audio.delta", ({ delta }) => reply.push(Buffer.from(delta, "base64")));
realtime.on("response.done", async () => {
await writeFile("reply.pcm", Buffer.concat(reply));
realtime.close();
});
realtime.on("error", console.error);
if (realtime.socket.readyState !== 1) await once(realtime.socket, "open");
const format = { type: "audio/pcm", rate: 24000 };
realtime.send({
type: "session.update",
session: {
voice: "eve",
output_modalities: ["audio"],
turn_detection: { type: null },
audio: { input: { format }, output: { format } }
}
});
realtime.send({ type: "input_audio_buffer.append", audio: (await readFile("question.pcm")).toString("base64") });
realtime.send({ type: "input_audio_buffer.commit" });
realtime.send({ type: "response.create" });
