Usage
We follow the OpenAI signature where you can send the input text and the voice option as a part of the API request. All the output formats mp3, opus, aac, flac, and pcm are supported. The AI Gateway also supports real time audio streaming for TTS models.
Here’s an example:
OpenAI NodeJS
OpenAI Python
cURL
On completion, the request will get logged in the logs UI and show the cost and latency incurred.
SSE Streaming
OpenAI and Azure OpenAI support Server-Sent Events (SSE) streaming for the speech endpoint. Set stream_format to "sse" to receive audio data as a stream of events:
Google Vertex AI TTS
Google Vertex AI offers Gemini TTS models with advanced features like multi-speaker synthesis and style control. The AI Gateway supports two methods:
- Chat Completions with
speech_config - Use Gemini TTS through the chat completions endpoint
- Audio Speech endpoint - OpenAI-compatible
/audio/speech endpoint
Chat Completions
Audio Speech
For detailed documentation including multi-speaker synthesis, style prompts, and all available voices, see Google Vertex AI Text-to-Speech.Last modified on September 15, 2026