Gemini 3.1 Flash TTS Preview is Google's text-to-speech model, released 2026-04, a substantial step up from Gemini 2.5 Flash TTS. It covers 70+ languages and introduces 200+ inline audio tags for steering delivery, emotion, and pacing mid-sentence. The model supports two speakers with independent voice and style configuration, outputs 24 kHz / 16-bit mono PCM, and watermarks output with SynthID.
Channels
Every channel serves the same model, but they differ in price and stability. On each API key in the Platform, you pick a primary and a backup channel per vendor, and each billing line shows which channel served the request.
Context pricing
This model’s price depends on how much input context a request carries. The headline price is the cheapest band, and a longer prompt moves the whole request into a higher one.
Quick start
POST /v1/audio/speechimport os from openai import OpenAI client = OpenAI( base_url="https://api.mirapi.ai/v1", # changed api_key=os.environ["MIRAPI_API_KEY"], # changed ) with client.audio.speech.with_streaming_response.create( model="gemini-3.1-flash-tts-preview", voice="alloy", input="The quick brown fox jumped over the lazy dog.", ) as resp: resp.stream_to_file("speech.mp3")
import fs from "node:fs"; import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.mirapi.ai/v1", // changed apiKey: process.env.MIRAPI_API_KEY, // changed }); const mp3 = await client.audio.speech.create({ model: "gemini-3.1-flash-tts-preview", voice: "alloy", input: "The quick brown fox jumped over the lazy dog.", }); fs.writeFileSync("speech.mp3", Buffer.from(await mp3.arrayBuffer()));
curl https://api.mirapi.ai/v1/audio/speech \ -H "Authorization: Bearer $MIRAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-3.1-flash-tts-preview", "voice": "alloy", "input": "The quick brown fox jumped over the lazy dog." }' \ --output speech.mp3
Links
1M free tokens to start, no card required. It’s OpenAI-compatible, so you only change the base URL.