# TTS文本转语音

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/audio/speech:
    post:
      summary: TTS文本转语音
      deprecated: false
      description: |-
        了解如何将文本转换为音频。

        相关指南：[本转换为音频](https://platform.openai.com/docs/guides/text-to-speech)

        将输入文本转录为音频。
      tags:
        - 模型接口/音频接口（Audio）
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: true
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: 可用的 TTS 模型之一:tts-1 或 tts-1-hd
                input:
                  type: string
                  description: 要生成音频的文本。最大长度为4096个字符。
                voice:
                  type: string
                  description: 生成音频时使用的语音。支持的语音有:alloy、echo、fable、onyx、nova 和 shimmer。
                response_format:
                  type: string
                  description: 默认为 mp3 音频的格式。支持的格式有:mp3、opus、aac 和 flac。
                speed:
                  type: number
                  description: 默认为 1 生成的音频速度。选择0.25到4.0之间的值。1.0是默认值。
              required:
                - model
                - input
                - voice
              x-apifox-orders:
                - model
                - input
                - voice
                - response_format
                - speed
            example:
              model: tts-1
              input: The quick brown fox jumped over the lazy dog.
              voice: alloy
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
                x-apifox-orders: []
              example:
                model: tts-1
                input: The quick brown fox jumped over the lazy dog.
                voice: alloy
          headers: {}
          x-apifox-name: 成功
      security:
        - bearer: []
      x-apifox-folder: 模型接口/音频接口（Audio）
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/3917179/apis/api-142078837-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://api.tutujin.com/v1
    description: 正式环境
security:
  - bearer: []

```
