API中文文档
  1. 音频(Audio)
API中文文档
  • 介绍
  • 项目说明
  • 导言
  • 身份验证
  • 参数详情
  • 音频(Audio)
    • 创建语音
      POST
    • 创建转录
      POST
    • 创建翻译
      POST
  • 聊天(Chat)
    • 聊天完成对象
    • 聊天完成块对象
    • 创建聊天补全
      POST
  • 自动补全(Completions)
    • 完成对象
    • 创建完成
      POST
  • 模型(Models)
    • 模型对象
    • 列出模型
      GET
    • 检索模型
      GET
  1. 音频(Audio)

创建语音

POST
https://www.askapi.chat/v1/audio/speech

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
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": "tts-1",
  "input": "The quick brown fox jumped over the lazy dog.",
  "voice": "alloy"
}

示例代码

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://www.askapi.chat/v1/audio/speech' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "tts-1",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
  }'

返回响应

🟢200成功
application/json
Body
object {0}
示例
{}
上一页
参数详情
下一页
创建转录
Built with