xAI Grok audio models now available on Vercel AI Gateway
xAI's Grok audio models are now live on AI Gateway, including realtime voice, text-to-speech, and speech-to-text capabilities. These models are available through the AI SDK with the same routing, observability, and spend controls as other models, and can be used directly in the AI Gateway playground.
are now live on AI Gateway. Realtime voice, text to speech, and speech to text are all available through the with the same routing, observability, and spend controls as your other models.xAI's audio modelsAI SDK
These capabilities are available on the AI SDK 7 release.
A voice agent has two pieces: a server route that mints a short-lived token, so your API key never reaches the client, and a browser component that connects with it.
Add the token route: this example sets to :modelxai/grok-voice-think-fast-1.0
Then connect from the browser. The hook from fetches that route and manages the WebSocket connection, microphone capture, and audio playback:useRealtime@ai-sdk/react
Generate from text with . Pass a voice and an output format, then write the result to a file with :spoken audiogenerateSpeechxai/grok-tts
recordings into text with . This example uses :Transcribetranscribexai/grok-stt
You can also try the xAI audio models directly in the AI Gateway playground. Open the and click into any of the models to use them directly in the browser. The playground allows you to talk to the agent and see responses instantly:models listherexai/grok-voice-think-fast-1.0
Available models
Realtime
Text to speech
Speech to text
Playground
Capability | Models |
|---|---|
Realtime voice |
|
Text to speech |
|
Speech to text |
|
More information
Source: original entry ↗