Skip to main content
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",
  "stream_format": "audio",
  "speed": 1,
  "instructions": "<string>",
  "retries": 0
}
'
"<string>"

Documentation Index

Fetch the complete documentation index at: https://docs.geekai.co/llms.txt

Use this file to discover all available pages before exploring further.

Note: For speech model name settings, refer to the System Supported Speech Model List. The request/response parameter structure is fully compatible with OpenAI. When switching models, you only need to modify the corresponding model name. If the model request/response parameters are inconsistent with OpenAI, GeekAI will automatically convert and align them at the backend.
The response data format is fully compatible with OpenAI, returning the binary data of the audio file.

cURL Request Example

curl --location 'https://geekai.dev/api/v1/audio/speech' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: {YOUR_GEEKAI_API_KEY}' \
    --data '{
        "input":"Hello! Nice to meet you!",
        "model":"tts-1",
        "voice":"ash",
        "speed":"1.0"
    }'

Authorizations

Authorization
string
header
required

API认证token

Body

application/json
model
string
required

语音模型

Example:

"tts-1"

input
string
required

需要转换的文本内容

Example:

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

voice
string

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

Example:

"alloy"

response_format
string
default:mp3

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

stream_format
enum<string>
default:audio

语音输出格式,支持 sse/audio 两种格式,sse表示流式输出,audio表示输出音频文件,默认为audio

Available options:
sse,
audio
speed
enum<number>
default:1

语速,取值范围[0.25, 1.0, 4.0],默认1.0,其中豆包语音模型仅支持[0.5, 1, 2]三个档位

Available options:
0.25,
0.5,
1,
2,
4
instructions
string

使用额外指令来控制生成的音频音调,仅 gpt-4o-mini-tts 模型支持该参数

retries
integer
default:0

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

Response

成功响应

MP3格式音频