Grok TTS API リファレンス
20言語・71種類の声。スピーチタグに対応
PopNow の API キー 1 つで、Grok TTS を自分のコードから呼び出せます。送るモデル ID、受け付ける入力フィールド、1 回あたりのクレジット、ターミナルに貼ってそのまま動くリクエストをこのページにまとめました。
パラメーターの説明はモデルの入力 schema から取っているため、英語のみです。
概要
- 開発元
- xAI
- 出力
- 音声
- 最安
- 2.7 クレジット 1,000 文字あたり ($0.027)
1 クレジット = 0.01 米ドル。タスクの受付時に上限額を確保し、完了時に実際の使用量で精算します(整数クレジットに切り上げ、差額は返却)。失敗したタスクには課金されません。実行前に正確な金額を知りたいときは POST /api/v1/jobs/quote を呼んでください。
テキスト読み上げ
xai/grok-tts/text-to-speech
料金
| オプション | クレジット (1,000 文字あたり) | 米ドル |
|---|---|---|
既定 | 2.7 | $0.027 |
パラメーター
| フィールド | 型 | 既定値 | 指定できる値 | 説明 |
|---|---|---|---|---|
text必須 | string | — | 15,000 文字まで | The words to be spoken, with optional speech tags such as [laugh] or <whisper>…</whisper>. Billed per 1,000 characters, tags included. |
voice_id任意 | string | eve | ara, eve, leo, rex, sal, jpi39icg, d18jlf6v, 33g9t0jl, 26w6ihxi, dr8gqysu, wy0m9l5w, om17cury, x7avnu1k, bcs7l2c3, … (+57) | Preset voice. Eve, Ara, Leo, Rex and Sal speak every supported language; the others are tuned for one language. |
language任意 | string | auto | auto, en, zh, ar-EG, ar-SA, ar-AE, bn, fr, de, hi, id, it, ja, ko, … (+7) | Reading language, or auto to detect it from the text. |
speed任意 | number | 1 | 0.7〜1.5 | Speaking speed from 0.7 (slower) to 1.5 (faster). |
output_format任意 | string | mp3 | mp3, wav, pcm, mulaw, alaw | Audio encoding. pcm, mulaw and alaw are raw streams without a file header, for phone systems. |
sample_rate任意 | integer | 24000 | 8000, 16000, 22050, 24000, 44100, 48000 | Sample rate in Hz. 8000 for phone lines, 44100 or 48000 for studio work. |
bitrate任意 | integer | 128000 | 32000, 64000, 96000, 128000, 192000 | MP3 bit rate in bits per second. Only applies to mp3. |
text_normalization任意 | boolean | false | — | Rewrite numbers, abbreviations and symbols as spoken words before reading. |
optimize_streaming_latency任意 | integer | 0 | 0, 1, 2 | Streaming latency level: 0 best quality, 1 smaller first chunk, 2 smallest first chunk with more quality trade-off at chunk boundaries. |
リクエスト例
このリクエストはそのまま実行できます。省略したフィールドには既定値が入ります。先にキーを環境変数 POPNOW_API_KEY に設定してください。
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: $(uuidgen)" \
-d '{
"model": "xai/grok-tts/text-to-speech",
"input": {
"text": "Hi there! This voice was created with the PopNow API in just a few seconds."
}
}'レスポンスにはすぐに taskId が入ります。結果は GET /api/v1/jobs/recordInfo で取得するか、callBackUrl を付けて通知を受け取ります。
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=TASK_ID_FROM_CREATE_TASK" \
-H "Authorization: Bearer $POPNOW_API_KEY"
