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

# Audio · Speech

> 使用文本转语音接口生成 MP3/PCM 音频，可自定义音色与格式。

`POST /v1/audio/speech` 返回二进制音频流。支持 `gpt-4o-mini-tts`、`gpt-4o-audio-preview` 等模型。

## 请求示例（cURL）

```bash theme={null}
curl -X POST "https://models.phanedge.cloud/v1/audio/speech" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini-tts",
    "voice": "alloy",
    "input": "你好，欢迎使用 PhanEdge！"
  }' \
  --output phanedge-tts.mp3
```

## 参数速览

* `voice`：音色 ID，兼容 OpenAI 官网上所有可用选项。
* `response_format`：控制输出封装，例如 `mp3-1-32000-128000`、`wav` 等。
* `speed`：语速（0.25 \~ 4）。

<Callout type="tip">
  如果希望直接返回音频 URL，可结合 PhanEdge 的媒体存储服务或使用 MiniMaxi 文档中的 `files/retrieve` 接口。
</Callout>


## OpenAPI

````yaml POST /v1/audio/speech
openapi: 3.0.3
info:
  title: PhanEdge Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the PhanEdge user
    docs.
servers:
  - url: https://models.phanedge.cloud
security:
  - BearerAuth: []
paths:
  /v1/audio/speech:
    post:
      tags:
        - OpenAI Audio
      summary: Text-to-speech
      requestBody:
        $ref: '#/components/requestBodies/JsonObject'
      responses:
        '200':
          description: Audio stream
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
components:
  requestBodies:
    JsonObject:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  schemas:
    GenericObject:
      type: object
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <token>'

````