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

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

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

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

## 核心能力

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

## 快速範例

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/models/gemini-2.5-flash-preview-tts: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-2.5-flash-preview-tts: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 | 是  | 語音與音色設定。   |
