# Gemini TTS API: voices, tone control, and audio formats for speech synthesis Source: https://ofox.ai/docs/develop/models/gemini-tts Google's Gemini speech synthesis models, called through the OpenAI-compatible `POST /v1/audio/speech`. You can describe tone and style in natural language. **Common model IDs (copy them exactly)** - Gemini 3.8 Flash TTS: `google/gemini-3.8-flash-tts` - Gemini 3.8 Flash-Lite TTS: `google/gemini-3.8-flash-lite-tts` — Lower rate For all TTS models, see the [models page](https://ofox.ai/models?provider=google). For the common endpoint parameters, see [Audio Speech API](https://ofox.ai/docs/api/openai/audio-speech). ## Examples **Python** ```python filename="gemini_tts.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) with client.audio.speech.with_streaming_response.create( model="google/gemini-3.8-flash-tts", voice="Kore", input="The meeting today has moved to 3 p.m. Please be on time.", instructions="Read in a calm, clear tone, like a news broadcast.", response_format="wav", ) as resp: resp.stream_to_file("speech.wav") ``` **cURL** ```bash filename="Terminal" curl https://api.ofox.ai/v1/audio/speech \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "google/gemini-3.8-flash-tts", "voice": "Kore", "input": "The meeting today has moved to 3 p.m. Please be on time.", "instructions": "Read in a calm, clear tone, like a news broadcast.", "response_format": "wav" }' \ --output speech.wav ``` ## Parameter values **Key point**:voice is required and takes a Google voice name; only wav and pcm output formats are supported. | Parameter | Description | |---|---| | `voice` | **Required.** A Google voice name, such as `Kore`, `Puck`, or `Zephyr`. For the full list, see [Gemini official docs · Voices](https://ai.google.dev/gemini-api/docs/speech-generation#voices). OpenAI voice names (such as `alloy`) cannot be used | | `response_format` | `wav` (default) or `pcm`, both 24 kHz, 16-bit, mono. `mp3`, `opus`, `aac`, and `flac` are not supported | | `instructions` | Describes tone, pace, and style in natural language, such as "in a cheerful tone" or "slow down" | | `language_code` | Language code, such as `cmn-CN` or `en-US`; detected automatically from the text if omitted | | `stream_format` | Set to `sse` to receive audio chunks as a stream, suited to playing while generating | If you need mp3, fetch wav first and convert it with a tool such as ffmpeg: `ffmpeg -i speech.wav speech.mp3`. ## Latency and long text In our tests, a Chinese sentence of about 20 characters returned in about 3 seconds. About 6,000 characters of English produced about 9 minutes of audio in about 105 seconds, with a wav file of about 26 MB. For long text, set the client timeout to 300 seconds or more, or use `stream_format: "sse"` to fetch it as a stream. ## Common errors | HTTP | Error message | Cause | Fix | |---|---|---|---| | 400 | `voice is required for speech completion` | `voice` was not sent | Pass a voice name, such as `Kore` | | 400 | `Request contains an invalid argument.` | The voice name does not exist, e.g. `alloy` was passed | Use a Google voice name | | 400 | `unsupported Gemini response_format: mp3` | Unsupported format | Use `wav` or `pcm` | For more errors, see [Audio Speech API](https://ofox.ai/docs/api/openai/audio-speech#errors). ## Official docs - [Gemini API · Speech generation](https://ai.google.dev/gemini-api/docs/speech-generation) ## FAQ **What do I put in voice for Gemini TTS?** A Google voice name, such as Kore, Puck, or Zephyr; the full list is in the official Gemini docs. voice is required, and OpenAI voices such as alloy cannot be used. **Can Gemini TTS output mp3?** No. Only wav and pcm (24 kHz, 16-bit, mono) are supported. If you need mp3, convert it yourself, e.g. ffmpeg -i speech.wav speech.mp3. **How do I control tone with Gemini TTS?** Describe it in natural language with the instructions parameter, for example "read in a cheerful tone" or "calm and steady, like a news broadcast". **Gemini TTS returns voice is required?** Gemini TTS requires voice, for example "voice": "Kore".