One-API
    One-API
    • 北极圈API
    • 模型定价
    • 项目对接
      • Midjourney PLUS
      • ChatGPT-Next-Web
      • NineAI(本站购买送额度)
        • NineAI项目介绍
        • V3设置模型及令牌
        • V3对接TTS语音模块
        • V3版本对接Gpts应用
        • V3新版MJ绘画设置
        • V3对接Dalle绘画功能
    • 列出模型
      GET
    • 聊天请求
      POST
    • TTS请求
      POST

      TTS请求

      开发环境
      https://api.openai.one/v1
      开发环境
      https://api.openai.one/v1
      POST
      https://api.openai.one/v1/audio/speech
      相关指南:本转换为音频
      将输入文本转录为音频。

      请求参数

      Header 参数
      Content-Type
      string 
      可选
      示例值:
      application/json
      Authorization
      string 
      可选
      示例值:
      Bearer {{YOUR_API_KEY}}
      Body 参数application/json
      model
      string 
      必需
      可用的 TTS 模型之一:tts-1 或 tts-1-hd
      input
      string 
      必需
      要生成音频的文本。最大长度为4096个字符。
      voice
      string 
      必需
      生成音频时使用的语音。支持的语音有:alloy、echo、fable、onyx、nova 和 shimmer。
      response_format
      string 
      可选
      默认为 mp3 音频的格式。支持的格式有:mp3、opus、aac 和 flac。
      speed
      number 
      可选
      默认为 1 生成的音频速度。选择0.25到4.0之间的值。1.0是默认值。
      示例
      {
          "model": "string",
          "input": "string",
          "voice": "string",
          "response_format": "string",
          "speed": 0
      }

      示例代码

      Shell
      JavaScript
      Java
      Swift
      Go
      PHP
      Python
      HTTP
      C
      C#
      Objective-C
      Ruby
      OCaml
      Dart
      R
      请求示例请求示例
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://api.openai.one/v1/audio/speech' \
      --header 'Authorization: Bearer ' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "model": "string",
          "input": "string",
          "voice": "string",
          "response_format": "string",
          "speed": 0
      }'

      返回响应

      🟢200成功
      application/json
      Body
      object {0}
      示例
      {
          "model": "tts-1",
          "input": "你好.",
          "voice": "alloy"
      }
      修改于 2024-02-05 09:25:02
      上一页
      聊天请求
      Built with