curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "xai-tts-1",
"callback_url": "https://your-domain.com/callback",
"input": {
"text": "Welcome to the xAI text to speech demo. [pause] <whisper>This line is softer.</whisper> [laugh] Now back to a clear product narration voice.",
"voice": "eve",
"language_code": "auto",
"output_format": {
"codec": "mp3",
"sample_rate": 24000,
"bit_rate": 128000
}
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2026-06-25T10:30:00"
}
}{
"code": 200,
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"code": 200,
"error": {
"message": "<string>",
"type": "<string>"
}
}xAI
xAI TTS 1
xAI TTS 1 API 可将最多 15,000 个字符的文本转换为语音,支持五种音色之一、BCP-47 语言代码或自动检测,以及行内演绎标签。可选择编码格式、采样率和 MP3 码率。
POST
/
api
/
generate
/
submit
curl --request POST \
--url https://api.poyo.ai/api/generate/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "xai-tts-1",
"callback_url": "https://your-domain.com/callback",
"input": {
"text": "Welcome to the xAI text to speech demo. [pause] <whisper>This line is softer.</whisper> [laugh] Now back to a clear product narration voice.",
"voice": "eve",
"language_code": "auto",
"output_format": {
"codec": "mp3",
"sample_rate": 24000,
"bit_rate": 128000
}
}
}
'{
"code": 200,
"data": {
"task_id": "task-unified-1757165031-uyujaw3d",
"status": "not_started",
"created_time": "2026-06-25T10:30:00"
}
}{
"code": 200,
"error": {
"message": "<string>",
"type": "<string>"
}
}{
"code": 200,
"error": {
"message": "<string>",
"type": "<string>"
}
}- 提交后会返回
task_id。如果提供了callback_url,当任务状态变为finished或failed时,系统会向callback_url发送 POST 请求。 - 无论是否提供
callback_url,都可以通过统一的查询任务状态接口获取结果。
xai-tts-1 通过 fal 调用 xAI TTS,将文本转换为低延迟、富有表现力的语音音频。结果以任务 files 返回,与图像、视频、3D 和音频任务的标准响应结构一致。
模型
- xai-tts-1 - xAI TTS v1 文本转语音生成
必填参数
- text:要转换为语音的文本
- 长度:
1-15000个字符 - 支持富有表现力的语音标签,例如
[laugh]、[pause]、[sigh]、<whisper>text</whisper>和<slow>text</slow>
- 长度:
可选参数
- voice:预设音色。支持的值:
eve、ara、rex、sal、leo。默认:eve - language_code:BCP-47 语言代码,或
auto表示自动检测。默认:auto - output_format:音频输出配置对象:
codec:mp3、wav、pcm、mulaw或alaw。默认:mp3sample_rate:8000、16000、22050、24000、44100或48000。默认:24000bit_rate:32000、64000、96000、128000、192000或null。仅适用于 MP3。默认:128000
示例
{
"model": "xai-tts-1",
"callback_url": "https://your-domain.com/callback",
"input": {
"text": "Welcome to the xAI text to speech demo. [pause] <whisper>This line is softer.</whisper> [laugh] Now back to a clear product narration voice.",
"voice": "eve",
"language_code": "auto",
"output_format": {
"codec": "mp3",
"sample_rate": 24000,
"bit_rate": 128000
}
}
}
注意事项
支持的语言
支持的值:auto、en、ar-EG、ar-SA、ar-AE、bn、zh、fr、de、hi、id、it、ja、ko、pt-BR、pt-PT、ru、es-MX、es-ES、tr、vi。
- PoYo 对外公开的参数名是
language_code,在上游映射到 fal 的language字段。 - PoYo 对外公开的参数名是
text,在上游映射到 fal 的text字段。 - 通过标准任务状态 API 查询状态。
- 成功响应返回
files,其中生成的语音使用file_type: audio。
授权
所有 API 接口都需要 Bearer Token 认证。
创建 API Key:登录 PoYo,进入 仪表盘 → API 密钥(poyo.ai/zh/dashboard/api-key),点击创建 Key。
在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
响应
任务提交成功
Show child attributes
Show child attributes