# Build realtime voice agents on AI Gateway

By Steven Van · 2026-06-29

Realtime voice, text to speech, and speech to text launch in beta on AI Gateway with OpenAI and xAI models, via AI SDK 7.

Vercel's [Vercel](<https://creatorstoolbox.com/tools/vercel>) AI Gateway now supports audio, adding realtime voice, text to speech, and speech to text alongside the text, image, and video calls it already handles. The [audio launch](<https://vercel.com/blog/realtime-voice-agents-on-ai-gateway>) ships with models from OpenAI and xAI, is in beta, and works with AI SDK 7. Every audio call gets the same provider routing, observability, spend controls, and bring-your-own-key support as other modalities.

- Realtime voice: live audio in and out for two-way conversation, for voice assistants and customer support agents.

- Text to speech: text in, audio file out, for voiceovers and spoken responses.

- Speech to text: recorded audio in, text out, for transcribing voice notes and call recordings.

Realtime voice agents use a single model that hears and produces audio directly, instead of chaining speech-to-text, a language model, and text-to-speech. In the browser, the useRealtime hook handles the WebSocket connection, microphone capture, and playback, while a server-minted, short-lived token keeps the Gateway API key off the client. Sessions are capped at 25 minutes, close after 5 minutes idle or if the client sends nothing in the first 30 seconds, and reject messages over 256 KB. Image input isn't supported in realtime sessions, and reconnecting starts a new session rather than resuming the old one.

[![](<https://vercel.com/api/docs-og?title=Realtime&format=docs&sig=c3d9ee80fac611cd00d685c7bc93d16bde3a68522bd59a1c405e334e92cdb805&category=Build%20AI%20apps&subcategory=AI%20Gateway&subcategory2=Modalities>)](<https://vercel.com/docs/ai-gateway/modalities/realtime>)

![Vercel](<https://www.google.com/s2/favicons?domain=vercel.com&sz=128>)

Vercel

The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.

[View Vercel →](<https://creatorstoolbox.com/tools/vercel>)

Sources

[Original source](<https://vercel.com/docs/ai-gateway/modalities/realtime>)

[Read Build realtime voice agents on AI Gateway on Creators Toolbox](<https://creatorstoolbox.com/blog/vercel-build-realtime-voice-agents-on-ai-gateway>)

---
Canonical source: https://creatorstoolbox.com/blog/vercel-build-realtime-voice-agents-on-ai-gateway
