> ## 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.1 Flash TTS Preview

> Gemini 3.1 Flash TTS Preview：文字轉語音模型。包含 MixRoute 呼叫範例與參數。

Gemini 3.1 Flash TTS Preview 是 Google 推出的文字轉語音模型。

可透過 MixRoute 的 Gemini 原生端點呼叫 `gemini-3.1-flash-tts-preview`。

## 核心能力

* 文字轉語音 - 將文字轉換為生成音訊
* 音色選擇 - 設定預置音色
* 音訊輸出 - 返回生成的語音資料

## 快速範例

**cURL**

```bash theme={null}
curl "https://api.mixroute.ai/v1/models/gemini-3.1-flash-tts-preview:generateContent" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Say clearly: Welcome to MixRoute."
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "AUDIO"
    ],
    "speechConfig": {
      "voiceConfig": {
        "prebuiltVoiceConfig": {
          "voiceName": "Kore"
        }
      }
    }
  }
}'
```

**Python**

```python theme={null}
import requests

response = requests.post(
    "https://api.mixroute.ai/v1/models/gemini-3.1-flash-tts-preview:generateContent",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={'contents': [{'parts': [{'text': 'Say clearly: Welcome to MixRoute.'}]}],
          'generationConfig': {'responseModalities': ['AUDIO'],
                               'speechConfig': {'voiceConfig': {'prebuiltVoiceConfig': {'voiceName': 'Kore'}}}}},
)

print(response.json())
```

## 參數

| 參數 | 類型 | 必填 | 說明 |
| - | - | - | - |
| `contents` | array | 是 | 需要朗讀的文字內容。 |
| `generationConfig.responseModalities` | array | 是 | 設定為 AUDIO。 |
| `generationConfig.speechConfig` | object | 是 | 語音與音色設定。 |


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