POST
/
audio
/
speech
curl --request POST \
  --url https://geekai.co/api/v1/audio/speech \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "tts-1",
  "input": "你好, 很高兴见到你!",
  "voice": "alloy",
  "response_format": "mp3",
  "instructions": "<string>",
  "speed": 1,
  "retries": 0
}'
This response does not have an example.

注:语音模型名称设置参考系统支持语音模型列表,请求/响应参数结构完全兼容 OpenAI,切换模型时只需修改对应的模型名称即可,若模型请求/响应参数和OpenAI不一致,极客智坊底层会自动转换对齐。

响应数据格式和 OpenAI 完全兼容,即返回音频文件的二进制数据。

关于文本转语音 API 调用示例,可以参考这里:文本对话

请求/响应参数明细

Authorizations

Authorization
string
header
required

JWT认证token

Body

application/json
model
string
required

语音模型

Example:

"tts-1"

input
string
required

需要转换的文本内容

Example:

"你好, 很高兴见到你!"

voice
string

声音角色,不同平台支持的声音角色可能不一样,更多细节请查看文本转语音示例

Example:

"alloy"

response_format
string
default:mp3

音频格式,不同平台支持格式可能不一样,更多细节请查看文本转语音示例

instructions
string

使用额外指令来控制生成的音频音调,不适用于 tts-1tts-1-hd

speed
enum<number>
default:1

语速,取值范围[0.25, 1.0, 4.0],默认1.0

Available options:
0.25,
1,
4
retries
integer
default:0

自动重试次数,默认0,表示失败不重试

Response

200
audio/mpeg
成功响应

MP3格式音频