關於 Grok TTS
71 種音色、20 種語言,支援語氣標籤。
在 POST /jobs/createTask 把模型名稱填成 xai/grok-tts/text-to-speech 就能呼叫,3 點數/1,000 字元起(US$0.03)。新帳戶送 30 點數,可以先在 Playground 免費試用。
請求參數
| 參數 | 必填 | 說明 |
|---|---|---|
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.7 | US$0.027 |
每個任務會無條件進位到整數點數,所以最低檔跑一次是 3 點數/1,000 字元(US$0.03)。
想在執行前知道確切金額,把相同的請求內容送到 POST /jobs/quote 即可。
API 快速上手
三步驟呼叫 Grok TTS API
- 建立 API 金鑰. 登入 PopNow,在 API 主控台建立金鑰。金鑰以 sk-popnow- 開頭,和網站共用同一份點數。
- 送出請求. 對 POST /jobs/createTask 送出請求,model 填 xai/grok-tts/text-to-speech,input 依照參數表填寫。回應會立即傳回任務 ID。
- 取得結果. 用任務 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 金鑰,每次執行都會附上對應的程式碼。