> ## 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.

# GPT-4o Mini TTS

> GPT-4o Mini TTS：文本转语音模型。包含 MixRoute 调用示例与参数。

GPT-4o Mini TTS 是 OpenAI 推出的文本转语音模型。

可使用下方端点通过 MixRoute 调用 `gpt-4o-mini-tts`。

## 核心能力

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

## 快速示例

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/audio/speech" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gpt-4o-mini-tts",
      "voice": "alloy",
      "input": "Welcome to MixRoute.",
      "response_format": "wav"
    }' \
      --output speech.wav
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from pathlib import Path
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    with client.audio.speech.with_streaming_response.create(
        model="gpt-4o-mini-tts",
        voice="alloy",
        input="Welcome to MixRoute.",
        response_format="wav",
    ) as response:
        response.stream_to_file(Path("speech.wav"))
    ```
  </Tab>
</Tabs>

## 参数

| 参数                | 类型     | 必填 | 说明                     |
| ----------------- | ------ | -- | ---------------------- |
| `model`           | string | 是  | 固定为 `gpt-4o-mini-tts`。 |
| `input`           | string | 是  | 需要合成的文本。               |
| `voice`           | string | 是  | 用于语音生成的音色。             |
| `response_format` | string | 否  | 音频输出格式。                |
