> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/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`。

## 核心能力

* 文本转语音 - 将文本转换为生成音频
* 音色选择 - 配置预置音色
* 音频输出 - 返回生成的语音数据

## 快速示例

<Tabs>
  <Tab title="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"
            }
          }
        }
      }
    }'
    ```
  </Tab>

  <Tab title="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())
    ```
  </Tab>
</Tabs>

## 参数

| 参数                                    | 类型     | 必填 | 说明         |
| ------------------------------------- | ------ | -- | ---------- |
| `contents`                            | array  | 是  | 需要朗读的文本内容。 |
| `generationConfig.responseModalities` | array  | 是  | 设置为 AUDIO。 |
| `generationConfig.speechConfig`       | object | 是  | 语音与音色配置。   |
