xai/grok-tts/text-to-speech3 积分起 /1,000 字符

71 种音色、20 种语言,支持语气标签。

在 POST /jobs/createTask 里把模型名写成 xai/grok-tts/text-to-speech 即可调用,3 积分/1,000 字符起(US$0.03)。新账户送 30 积分,可以先在 Playground 里免费试。

  • 文字转语音
  • 71 种音色
  • 20 种语言

这份指南暂时只有英文。 →

请求参数

参数必填说明
text是The words to be spoken, with optional speech tags such as [laugh] or <whisper>…</whisper>. Billed per 1,000 characters, tags included.
speed否语速。 ≥ 0.7 · ≤ 1.5 · 默认值: 1
bitrate否MP3 bit rate in bits per second. Only applies to mp3. 32000 · 64000 · 96000 · 128000 · 192000 · 默认值: 128000
language否朗读的语言。 auto · en · zh · ar-EG · ar-SA · ar-AE · bn · fr · de · hi · id · it · ja · ko · pt-BR · pt-PT · ru · es-MX · es-ES · tr · vi · 默认值: auto
voice_id否从可用音色里挑一个。 ara · eve · leo · rex · sal · jpi39icg · d18jlf6v · 33g9t0jl · 26w6ihxi · dr8gqysu · wy0m9l5w · om17cury · x7avnu1k · bcs7l2c3 · hqxr4yub · h27ltdnz · 89q2pnko · 73xd5dum · 0p0rt7o1 · hbxkrnwm · 69smp8rm · yis75yfp · ekhwx401 · jupvcf34 · 0hhfxxqq · 0ih5oi34 · gwnexu6y · 97zmdc6s · fc7de6afcf6c · 7a9ee820b342 · 0895a5b8ce5c · f8cf5c2c78d4 · 96819d0bd28d · 79f3a8b96d43 · 78a495fdbb39 · e22152e06fd8 · 490ea3be50b1 · 1f046a033914 · dfe7b9e7d217 · c3a2c594479e · 83c6f4fea98e · 34fd4dce1ba3 · d634b6da3d3b · 670a0c3ac005 · 182a91893636 · d0cb9ff07d95 · b1a7441b97a1 · bf9fe5b5f981 · b5ae17439907 · a0401c9101f8 · 23be42535a45 · abfbdf26f115 · 6da5baee46d0 · 3d030bc92a87 · a13662ba951c · 58d27475085e · 247783ebdd51 · 244e27b39200 · 97fabd54445f · 37329fd8895a · 2badb5f46b1e · 1b12d5daee6b · 908c4626660f · 4ff93971bfdc · 70013edeb8e8 · 35c8d7f60dc8 · 23468361b4ef · 458705c07139 · 41321eb41295 · 40f31906b23d · 3a7889066fa2 · 默认值: eve
sample_rate否Sample rate in Hz. 8000 for phone lines, 44100 or 48000 for studio work. 8000 · 16000 · 22050 · 24000 · 44100 · 48000 · 默认值: 24000
output_format否结果的文件格式。 mp3 · wav · pcm · mulaw · alaw · 默认值: mp3
text_normalization否Rewrite numbers, abbreviations and symbols as spoken words before reading. 默认值: false
optimize_streaming_latency否Streaming latency level: 0 best quality, 1 smaller first chunk, 2 smallest first chunk with more quality trade-off at chunk boundaries. 0 · 1 · 2 · 默认值: 0

价格

价格以积分计,和网站上用的是同一种积分(1 积分 = $0.01)。任务受理时先冻结积分,完成后按实际费用结算;失败的任务会退还。

选项积分 /1,000 字符≈ 美元
标准2.7US$0.027

每个任务按整数积分向上取整,所以最低档跑一次是 3 积分/1,000 字符(US$0.03)。

想在运行前知道确切金额,把同样的请求体发到 POST /jobs/quote 即可。

API 快速上手

三步调用 Grok TTS API

  1. 创建 API 密钥. 登录 PopNow,在 API 控制台创建密钥。密钥以 sk-popnow- 开头,和网站共用同一份积分。
  2. 发送请求. 向 POST /jobs/createTask 发请求,model 填 xai/grok-tts/text-to-speech,input 按参数表填写。响应会立刻返回任务 ID。
  3. 取回结果. 用任务 ID 轮询 GET /jobs/recordInfo,或者传 callBackUrl,结果会推送到这个地址。任务成功后下载输出链接。
# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "model": "xai/grok-tts/text-to-speech",
  "input": {
    "text": "Welcome back. Your files finished rendering a minute ago and are ready to download.",
    "voice_id": "eve",
    "language": "auto"
  }
}'

# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

请把提示词和链接换成你自己的。API 页签里有响应、轮询和回调的参考。

Grok TTS API 常见问题

Grok TTS API 怎么收费?

Grok TTS:3 积分(US$0.03)/1,000 字符。积分和网站通用(1 积分 = $0.01),新账号赠送 30 积分,失败的任务会退还。

Grok TTS 在 API 里的调用名是什么?

在 POST /jobs/createTask 的 model 字段里填 文字转语音用 xai/grok-tts/text-to-speech。

Grok TTS API 有哪些限制?

文本长度(字符):15,000;音色:71;语言:20。超出这些限制的请求会在扣费之前被拒绝。

不写代码能试 Grok TTS 吗?

可以。Playground 用你的 PopNow 积分运行 Grok TTS,不需要 API 密钥,每次运行都会给出对应的代码。

全部 Grok 模型

关于 Grok TTS 的更多内容