Skip to content

Audio · Speech ​

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

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

请求示例(cURL) ​

bash
curl -X POST "https://aiapi.fhddos.com/v1/audio/speech" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini-tts",
    "voice": "alloy",
    "input": "你好,欢迎使用 Fhddos!"
  }' \
  --output fhddos-tts.mp3

参数速览 ​

  • voice:音色 ID,兼容 OpenAI 官网上所有可用选项。
  • response_format:控制输出封装,例如 mp3-1-32000-128000、wav 等。
  • speed:语速(0.25 ~ 4)。

TIP

如果希望直接返回音频 URL,可结合 Fhddos 的媒体存储服务或使用 MiniMaxi 文档中的 files/retrieve 接口。

OpenAPI ​

yaml
openapi: 3.0.3
info:
  title: Fhddos Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the Fhddos user
    docs.
servers:
  - url: https://aiapi.fhddos.com
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>'

Fhddos AI 用户文档