Skip to main content
POST
/
v1
/
tts
文本转语音
curl --request POST \
  --url https://api.voxnexus.ai/v1/tts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "Hello, this is a test message.",
  "voice_id": "vl-xiaoxiao",
  "language": "zh-CN",
  "format": "mp3",
  "sample_rate": 16000,
  "bit_rate": 128,
  "speed": 1,
  "pitch": 0,
  "volume": 1,
  "ssml": false,
  "voice_config": {
    "style": "cheerful",
    "role": "Girl",
    "degree": 0.5
  }
}
'
"<string>"

Authorizations

Authorization
string
header
required

使用 Bearer Token 进行认证,Token 为 API Key

Body

application/json
text
string
required

要转换的文本(必需)

Example:

"Hello, this is a test message."

voice_id
string
required

语音唯一标识符(必需)

Example:

"vl-xiaoxiao"

language
string

语言代码,ISO 639-1(可选)

Example:

"zh-CN"

format
enum<string>
default:mp3

音频格式(可选,默认: mp3)

Available options:
mp3,
wav,
ogg,
pcm,
webm
sample_rate
enum<integer>
default:16000

采样率(可选,默认: 16000)

Available options:
8000,
16000,
22050,
24000,
44100,
48000
bit_rate
integer
default:128

比特率(kbps),仅对压缩格式有效(可选,默认: 128)

Example:

128

speed
number<float>
default:1

语速倍数,范围: 0.5 - 2.0,默认: 1.0(可选)

Required range: 0.5 <= x <= 2
pitch
integer
default:0

音调偏移(半音),范围: -12 - 12,默认: 0(可选)

Required range: -12 <= x <= 12
volume
number<float>
default:1

音量倍数,范围: 0.0 - 1.0,默认: 1.0(可选)

Required range: 0 <= x <= 1
ssml
boolean
default:false

是否使用SSML格式的text(可选,默认: false)

voice_config
object

语音特定配置(可选,根据voice_id支持的配置项使用)

Example:
{
"style": "cheerful",
"role": "Girl",
"degree": 0.5
}

Response

成功返回音频流

The response is of type file.