> ## Documentation Index
> Fetch the complete documentation index at: https://mixroute.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 3.8 Flash-Lite TTS

> Gemini 3.8 Flash-Lite TTS: Text-to-speech with structured speaking style and WAV output through the native Gemini endpoint.

Gemini 3.8 Flash-Lite TTS prioritizes lower latency and high-throughput speech generation. Google lists support for 101 languages.

Gemini 3.8 Flash-Lite TTS accepts text and returns audio. Provider limits are 8,192 input tokens and 16,384 output tokens; effective limits and availability depend on the MixRoute route. The examples use the existing native generateContent path, not an assumed Interactions or OpenAI audio endpoint.

## Request parameters

Write only the words to speak in parts\[].text. Put delivery instructions in parts\[].speechMetadata.style; do not prepend commands such as Say cheerfully, which can be spoken aloud. SDK/documentation may name this field speech\_metadata; REST JSON uses speechMetadata. Unary Gemini 3.8 output defaults to WAV, unlike the older raw-PCM default.

| Field | Description |
| - | - |
| `contents[].parts[].text` | Required. Exact text to speak. |
| `contents[].parts[].speechMetadata.style` | Optional speaking style and delivery instructions. |
| `generationConfig.responseModalities` | \["AUDIO"] |
| `generationConfig.speechConfig` | Use generationConfig.responseModalities=\["AUDIO"] and speechConfig.voiceConfig.prebuiltVoiceConfig.voiceName, such as Kore. For multi-speaker requests, each part's speechMetadata.speaker must match a configured speakerVoiceConfigs entry; do not combine single-voice and multi-speaker configurations. |

## Request examples

Set the MIXROUTE\_API\_KEY environment variable. The Python example uses only the standard library.

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/models/gemini-3.8-flash-lite-tts:generateContent" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "contents": [
    {
      "parts": [
        {
          "text": "Welcome to MixRoute.",
          "speechMetadata": {
            "style": "Warm, clear and unhurried."
          }
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  }
}'
```

## Read the audio output

Read candidates\[].content.parts\[].inlineData.data and mimeType. Base64-decode WAV data and write it directly; do not add another WAV header. The Python example rejects missing audio or non-WAV data rather than silently writing an invalid WAV file. Custom voice, streaming and other provider capabilities need separate route support.

```python theme={null}
import base64
import json
import os
from pathlib import Path
from urllib.request import Request, urlopen

payload = {
    "contents": [
        {
            "parts": [
                {
                    "text": "Welcome to MixRoute.",
                    "speechMetadata": {
                        "style": "Warm, clear and unhurried."
                    }
                }
            ]
        }
    ],
    "generationConfig": {
        "responseModalities": [
            "AUDIO"
        ],
        "speechConfig": {
            "voiceConfig": {
                "prebuiltVoiceConfig": {
                    "voiceName": "Kore"
                }
            }
        }
    }
}
request = Request(
    "https://api.mixroute.ai/v1/models/gemini-3.8-flash-lite-tts:generateContent",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urlopen(request, timeout=120) as response:
    result = json.load(response)

audio = next((
    part["inlineData"]
    for candidate in result.get("candidates", [])
    for part in candidate.get("content", {}).get("parts", [])
    if part.get("inlineData", {}).get("mimeType", "").startswith("audio/")
), None)
if not audio:
    reasons = [c.get("finishReason") for c in result.get("candidates", [])]
    raise RuntimeError(f"No audio: finishReason={reasons}; promptFeedback={result.get('promptFeedback')}")
mime_type = audio["mimeType"].split(";", 1)[0].strip().lower()
if mime_type not in ("audio/wav", "audio/x-wav"):
    raise RuntimeError(f"Expected WAV, received {mime_type}")
wav = base64.b64decode(audio["data"], validate=True)
if wav[:4] != b"RIFF" or wav[8:12] != b"WAVE":
    raise RuntimeError("The audio data is not a WAV file")
Path("speech.wav").write_bytes(wav)
print("speech.wav")
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.