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

# GPT-4o Mini TTS

> GPT-4o Mini TTS：文字轉語音模型。包含 MixRoute 呼叫範例與參數。

GPT-4o Mini TTS 是 OpenAI 推出的文字轉語音模型。

可使用下方端點透過 MixRoute 呼叫 `gpt-4o-mini-tts`。

## 核心能力

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

## 快速範例

**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
```

**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"))
```

## 參數

| 參數 | 類型 | 必填 | 說明 |
| - | - | - | - |
| `model` | string | 是 | 固定為 `gpt-4o-mini-tts`。 |
| `input` | string | 是 | 需要合成的文字。 |
| `voice` | string | 是 | 用於語音生成的音色。 |
| `response_format` | string | 否 | 音訊輸出格式。 |


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