# OpenAI/音频(Audio)

# POST 创建语音

POST /v1/audio/speech

Body 请求参数

{
  "model": "tts-1",
  "input": "The quick brown fox jumped over the lazy dog.",
  "voice": "alloy"
}

# 请求参数

名称 位置 类型 必选 说明
Authorization header string none
body body object none
» model body string 可用的 TTS 模型之一:tts-1 或 tts-1-hd
» input body string 要生成音频的文本。最大长度为4096个字符。
» voice body string 生成音频时使用的语音。支持的语音有:alloy、echo、fable、onyx、nova 和 shimmer。
» response_format body string 默认为 mp3 音频的格式。支持的格式有:mp3、opus、aac 和 flac。
» speed body number 默认为 1 生成的音频速度。选择0.25到4.0之间的值。1.0是默认值。

返回示例

200 Response

{}

# 返回结果

状态码 状态码含义 说明 数据模型
200 OK (opens new window) 成功 Inline

# 返回数据结构

# POST 创建转录

POST /v1/audio/transcriptions

Body 请求参数

file: string
model: string
language: string
prompt: string
response_format: string
temperature: 0

# 请求参数

名称 位置 类型 必选 说明
Authorization header string none
body body object none
» file body string(binary) 要转录的音频文件对象(不是文件名),格式为:flac、mp3、mp4、mpeg、mpga、m4a、ogg、wav 或 webm。
» model body string 要使用的模型 ID。目前只有 whisper-1 是可用的。
» language body string 输入音频的语言。以 ISO-639-1 格式提供输入语言可以提高准确性和延迟。
» prompt body string 一个可选的文本来指导模型的风格或继续之前的音频段落。提示应该与音频语言匹配。
» response_format body string 默认为 json
» temperature body number 默认为 0

# 详细说明

» response_format: 默认为 json 转录输出的格式,可选择:json、text、srt、verbose_json 或 vtt。

» temperature: 默认为 0 采样温度,between 0 和 1。更高的值像 0.8 会使输出更随机,而更低的值像 0.2 会使其更集中和确定性。如果设置为 0,模型将使用对数概率自动增加温度直到达到特定阈值。

返回示例

成功

{
  "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that."
}

# 返回结果

状态码 状态码含义 说明 数据模型
200 OK (opens new window) 成功 Inline

# 返回数据结构

状态码 200

名称 类型 必选 约束 中文名 说明
» text string true none none

# GET 创建翻译

GET /v1/audio/translations

Body 请求参数

file: string
model: string
prompt: string
response_format: string
temperature: 0

# 请求参数

名称 位置 类型 必选 说明
Authorization header string none
body body object none
» file body string(binary) 要翻译的音频文件对象(不是文件名),格式为:flac、mp3、mp4、mpeg、mpga、m4a、ogg、wav 或 webm。
» model body string 要使用的模型 ID。目前只有 whisper-1 是可用的。
» prompt body string 一个可选的文本,用于指导模型的风格或继续之前的音频段落。提示文本应该是英文。
» response_format body string 翻译结果的格式,可选择:json、text、srt、verbose_json 或 vtt。
» temperature body number 默认为 0

# 详细说明

» temperature: 默认为 0 采样温度,介于 0 和 1 之间。更高的值如 0.8 会使输出更随机,而较低的值如 0.2 会使其更聚焦和确定性。如果设置为 0,模型将使用对数概率自动提高温度直到达到特定阈值。

返回示例

成功

{
  "text": "Hello, my name is Wolfgang and I come from Germany. Where are you heading today?"
}

# 返回结果

状态码 状态码含义 说明 数据模型
200 OK (opens new window) 成功 Inline

# 返回数据结构

状态码 200

名称 类型 必选 约束 中文名 说明
» text string true none none