> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MiniMax Speech 2.8 API：用預設音色合成語音

> MiniMax 文字轉語音 API 和 APIXO 預設 voice_id 支援以及自訂 MiniMax voice_id 支援

## 概覽

MiniMax Speech 2.8 是一種用於產生高品質語音的非同步文字到語音模型。APIXO 透過記錄的預設支援內建預設聲音 `voice_id` 列表，也接受自訂 `voice_id` 值，該值由 [MiniMax Voice](https://apixo.ai/docs/zh-hant/models/audio/minimax-voice.md) 創建。

| 功能 | 值 |
| - | - |
| 模型 ID | `minimax-speech-2-8` |
| 模式 | `speech-turbo`, `speech-hd` |
| 內建預設聲音 | 是的，透過記錄的預設 `voice_id` 列表 |
| 自訂音色 | 是 |
| 提示詞長度 | 1 至 10000 個字元 |
| 發音字典格式 | `Alias/Pronunciation` |
| 速度範圍 | `0.5` 至 `2.0` |
| 音量範圍 | `0.1`至`10.0` |
| 螺距範圍 | `-12`至`12` |

> [!TIP]
>
> 有關完整的內建預設 `voice_id` 列表，請參閱 [MiniMax Speech 2.8 預設音色](https://apixo.ai/docs/zh-hant/guides/minimax-speech-2-8-voices.md)。

## 端點與身分驗證

API 基底網址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/minimax-speech-2-8` | 提交演講任務 |
| `GET` | `/statusTask/minimax-speech-2-8?taskId={taskId}` | 查詢任務狀態並取得結果 |

每個請求都必須附上 APIXO API 金鑰：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

送出任務時，還需設定以下請求標頭：

```http theme={null}
Content-Type: application/json
```

## 非同步請求範例

此最小請求提交語音任務並傳回 `taskId`。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-speech-2-8" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "speech-hd",
      "voice_id": "preset_general_wise_woman",
      "prompt": "Hello, welcome to APIXO.",
      "format": "mp3"
    }
  }'
```

成功提交回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing"
  }
}
```

請保留 `taskId`，後續輪詢結果時會用到。

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/minimax-speech-2-8?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

任務處理中的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1781502331739
  }
}
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/temp/output.mp3\"]}",
    "createTime": 1781502331739,
    "completeTime": 1781502332542,
    "costTime": 803
  }
}
```

任務失敗時的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "VALIDATION_ERROR",
    "failMsg": "The parameter {{voice_id}} is invalid.",
    "createTime": 1781502331739,
    "completeTime": 1781502332542
  }
}
```

等 `state` 變為 `success` 後，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const audioUrls = payload.resultUrls;
```

## 請求體

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "speech-hd",
    "voice_id": "preset_general_wise_woman",
    "prompt": "Welcome to APIXO.",
    "pronunciation_dict": [
      "Omg/Oh my god"
    ],
    "speed": 1.0,
    "volume": 1.0,
    "pitch": 0,
    "emotion": "happy",
    "sample_rate": 24000,
    "bitrate": 128000,
    "channel": "stereo",
    "format": "mp3",
    "language_boost": "English"
  }
}
```

## 參數

**request\_type** `string` *required* (default: async)

取得結果的方式。選擇 `async` 時，透過 `statusTask` 輪詢結果；選擇 `callback` 時，透過 Webhook 接收結果。

**callback\_url** `string`

當 `request_type` 為 `callback` 時必填。請提供可從網際網路存取的 HTTPS 網址，以接收任務的最終結果。詳見 [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

MiniMax Speech 2.8 的輸入參數。

**屬性**

**mode** `string` *required*

語音品質模式。支援的值：`speech-turbo`、`speech-hd`。

**voice\_id** `string` *required*

所需的語音選擇器。請使用預設 `voice_id` 從 [MiniMax Speech 2.8 預設音色](https://apixo.ai/docs/zh-hant/guides/minimax-speech-2-8-voices.md)，或使用自訂 `voice_id` 創建於 [MiniMax Voice](https://apixo.ai/docs/zh-hant/models/audio/minimax-voice.md)。

**prompt** `string` *required*

所需的合成文本。支援 1 至 10,000 字元。需要時，可包含暫停控制（例如 `<#0.5#>`）及表達標籤（例如 `(laughs)`、`(sighs)`、`(coughs)`）。

**pronunciation\_dict** `string[]`

可選的發音覆蓋。每個項目必須使用 `Alias/Pronunciation` 格式，例如 `Omg/Oh my god`。

**speed** `number`

選填的語速控制。APIXO 接受數字或數字字串，最終值必須在 `0.5` 至 `2.0` 之間。

**volume** `number`

可選音量控制。APIXO 接受數字或數字字串，最終值必須在 `0.1` 至 `10.0` 之間。

**pitch** `number`

選填的音高控制。APIXO 接受數字或數字字串，最終值必須在 `-12` 至 `12` 之間。

**emotion** `string`

選填的情緒控制。支援的值：`happy`、`sad`、`angry`、`fearful`、`disgusted`、`surprised`、`neutral`。

**sample\_rate** `integer`

可選輸出取樣率。APIXO 接受整數或數字字串。支援的值：`8000`、`16000`、`22050`、`24000`、`32000`、`44100`。

**bitrate** `integer`

可選輸出位元率。APIXO 接受整數或數字字串。支援的值：`32000`、`64000`、`128000`、`256000`。

**channel** `string`

選填的輸出通道選擇器。`1` = `mono`，`2` = `stereo`。支援的值：`1`、`2`、`mono`、`stereo`。

**format** `string`

選填的輸出格式。可用值為 `mp3`、`wav`、`pcm`、`flac`。

**language\_boost** `string`

可選語言提示。支援的值：`Chinese`, `Chinese,Yue`, `English`, `Arabic`, `Russian`, `Spanish`, `French`, `Portuguese`, `German`, `Turkish`, `Dutch`, `Ukrainian`, `Vietnamese`, `Indonesian`, `Japanese`, `Italian`, `Korean`, `Thai`, `Polish`, `Romanian`, `Greek`, `Czech`, `Finnish`, `Hindi`, `Bulgarian`, `Danish`, `Hebrew`, `Malay`, `Persian`, `Slovak`, `Swedish`, `Croatian`, `Filipino`, `Hungarian`, `Norwegian`, `Slovenian`, `Catalan`, `Nynorsk`, `Tamil`, `Afrikaans`, `auto`。

## 語音 ID 規則

* 使用預設 `voice_id` 列表於 [MiniMax Speech 2.8 預設音色](https://apixo.ai/docs/zh-hant/guides/minimax-speech-2-8-voices.md) 以取得內建音色。
* 使用傳回的自訂 `voice_id` 從 [MiniMax Voice](https://apixo.ai/docs/zh-hant/models/audio/minimax-voice.md) 來取得自訂複製或設計的聲音。
* 自訂 `voice_id` 值必須有效且可用於目前帳戶。
* 只有此頁面上記錄的欄位才是公共請求合約的一部分。APIXO 會忽略額外的不支援的欄位，除非它們與平台行為衝突。

## 提示行為

* `prompt` 支援普通旁白文本。
* 您可以在文字內使用暫停控件，例如 `<#0.5#>`。
* 如果有用，也可以包含內嵌表達標籤，例如 `(laughs)`、`(sighs)` 和 `(coughs)`。
* `pronunciation_dict` 是縮寫或別名發音覆蓋的正確位置。

## 定價

新提交的非 LLM 請求按 **1 點 = `$0.001`** 計費。先依用量和加購項目計算總額，再套用帳戶折扣，最後將請求總額無條件進位至整數點數。若已約定固定單價，則保留該單價的精度，不再使用標準價或另行打折；最終點數仍須進位。詳見[積分換算與進位](https://apixo.ai/docs/zh-hant/pricing.md#credit-conversion-and-rounding)。

| 模式 | 價格 |
| - | - |
| `speech-turbo` | `0.060 USD / 1000 characters` |
| `speech-hd` | `0.100 USD / 1000 characters` |

計費基於提交的 `prompt` 字元數。

## 回應格式

### 送出任務時的回應

任務受理後，`POST /generateTask/minimax-speech-2-8` 會傳回任務 ID：

**code** `integer`

API 狀態碼。`200` 表示任務已受理。

**message** `string`

狀態說明。

**data.taskId** `string`

任務的唯一 ID，用於查詢任務狀態。

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

目前的任務狀態，可能的值為 `processing`、`success`、`failed`。

**resultJson** `string`

內含音訊結果 URL 的 JSON 字串。`state` 為 `success` 時傳回。

**failCode** `string`

供程式判讀的錯誤碼，僅在 `state` 為 `failed` 時傳回。

**failMsg** `string`

失敗原因說明，僅在 `state` 為 `failed` 時傳回。

**createTime** `integer`

任務建立時的 Unix 時間戳記，單位為毫秒。

**completeTime** `integer`

任務完成時的 Unix 時間戳記，單位為毫秒。任務完成後才會傳回。

**costTime** `integer`

處理時間，以毫秒為單位。任務成功後傳回。

## Webhook 回呼模式

若希望後端自動收到最終結果，可使用回呼模式，無須輪詢。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/minimax-speech-2-8" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhooks/apixo",
    "input": {
      "mode": "speech-turbo",
      "voice_id": "preset_general_friendly_person",
      "prompt": "Hello, this result will be delivered by webhook."
    }
  }'
```

Webhook 的接收條件與重試規則請見 [Webhook 文件](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

## 耗時與輪詢

實際延遲會因文字長度、所選模式、佇列負載和路由運行狀況而異。

| 工作流程 | 一般生成時間 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - | - |
| `speech-turbo` | 5s-30s | 任務建立 5 秒後 | 3s-5s |
| `speech-hd` | 5s-30s | 任務建立 5 秒後 | 3s-5s |

## 錯誤與排查

### HTTP 錯誤

| 代碼 | 含義 | 處理方式 |
| - | - | - |
| `400` | 請求主體或參數結構有誤 | 修正請求後再試 |
| `401` | 缺少 API 金鑰，或金鑰無效 | 檢查 `Authorization` 請求標頭 |
| `402` | 餘額或配額不足 | 充值或更換帳號或金鑰 |
| `403` | 金鑰或路由無權訪問該模型 | 檢查權限和路由策略 |
| `429` | 已達到速率或並行限制 | 以指數退避方式重試 |
| `500` | 伺服器錯誤 | 逐步拉長間隔後重試 |
| `502` | 臨時模型服務錯誤 | 逐步拉長間隔後重試 |
| `504` | 處理超時 | 重試或使用回呼模式 |

### 通用驗證規則

* 需要 `mode`、`voice_id` 和 `prompt`。
* 內建音色必須使用預設的 `voice_id` 清單。
* 自訂 `voice_id` 值必須有效且可用於目前帳戶。
* `pronunciation_dict` 必須是字串陣列，且每一項必須使用 `Alias/Pronunciation` 格式。
* `speed`、`volume` 和 `pitch` 可以是數字字串，但最終值必須保持在記錄的範圍內。
* `sample_rate` 和 `bitrate` 可以是數字字串，但僅接受預設的選項值。
* `channel` 接受 `1`、`2`、`mono` 或 `stereo`，其中 `1=mono` 且 `2=stereo`。
* `emotion`、`format` 和 `language_boost` 必須與預設的支援值相符。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/audio/minimax-speech-2-8.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。模型參數由 API 驗證。

## 相關連結

* [MiniMax Speech 2.8預設音色](https://apixo.ai/docs/zh-hant/guides/minimax-speech-2-8-voices.md)
* [MiniMax Voice](https://apixo.ai/docs/zh-hant/models/audio/minimax-voice.md)
* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [音訊模型](https://apixo.ai/docs/zh-hant/models/audio)
* [送出生成任務](https://apixo.ai/docs/zh-hant/api-reference/generate-task.md)
* [查詢任務狀態](https://apixo.ai/docs/zh-hant/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)
* [錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [在 APIXO Playground 試用 MiniMax Speech 2.8](https://apixo.ai/models/minimax-speech-2-8)
* [API定價](https://apixo.ai/pricing/api)


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