Sand AISand AI MAGI-2MAGI-2 現已登上 SandBase:支援原生音訊的 1080p 影片立即試用

xAI Text to Speech

xai/grok-tts

Grok Tts by xAI - convert text to natural-sounding speech with AI. Supports multiple voices, languages, emotions, and speaking styles for content creation and accessibility.

基礎價格
$0.01美元/次執行
執行
async
模型類型
audio
輸入欄位
2
正式環境路由

試用這個模型

Playground

開啟 playground
輸入
The text to convert to speech. Maximum 15,000 characters. Supports speech tags for expressive delivery: inline tags like [laugh], [pause], [sigh] and wrapping tags like <whisper>text</whisper>, <slow>text</slow>.
The voice to use for speech synthesis.
輸出範例
  1. 接下來您想做什麼?

    開啟原始檔

範例

選擇一個範例,將其輸入與結果載入 playground。

模型卡片

規格

定價

基本價格
$0.01/次執行

上下文與多模態

輸入
由結構定義
輸出
audio

功能

聊天
不支援
視覺
不支援
推理
不支援
結構化輸出
不支援
函式呼叫
不支援
音訊輸入
不支援

存取

供應商
xAI
模型 ID
xai/grok-tts
執行
async
基礎 URL
https://api.sandbase.ai
API
Unified Run API
端點
/v1/run

API README

xAI Text to Speech

xAI text-to-speech with five voices (Eve, Ara, Rex, Sal, Leo).

Fields

FieldTypeDefaultNotes
textstring—Text to speak.
voiceeve / ara / rex / sal / leo—Voice.

Billing

$0.015 per started 1,000 characters, with a one-unit minimum.

TextPrice
200 characters$0.015
1,000 characters$0.015
2,500 characters$0.045

Failed runs are not charged.

開始建置

送出您的第一個請求

具備統一驗證與用量追蹤的 OpenAI 相容端點。

正式環境 API
Unified Run API 端點
https://api.sandbase.ai/v1/run
模型 ID
xai/grok-tts
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
  -X POST "https://api.sandbase.ai/v1/run" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<'SANDBASE_JSON'
{
  "model": "xai/grok-tts",
  "text": "Hello! This is xAI text to speech, brought to you by Fal AI."
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
  status=$(printf '%s' "$result" | jq -r .status)
  case "$status" in completed|failed|timeout) break ;; esac
  sleep 2
  result=$(curl --fail-with-body --silent \
    -H "Authorization: Bearer $SANDBASE_API_KEY" \
    "https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"
01

輸入 Schema

2 個參數 · 0 個必要 · 2 個選用

參數類型必要說明
textstring選用The text to convert to speech. Maximum 15,000 characters. Supports speech tags for expressive delivery: inline tags like [laugh], [pause], [sigh] and wrapping tags like <whisper>text</whisper>, <slow>text</slow>. · 最小長度:1 · 最大長度:15000
voicestring選用The voice to use for speech synthesis. · 選項:eve, ara, rex, sal, leo
eveararexsalleo
02

輸出 Schema

欄位類型說明
idstring生成任務的唯一識別碼
statusstring任務狀態:pending、running、completed、failed、timeout
modelstring用於生成的模型
outputsarray輸出項目陣列
outputs[].urlstring生成產物的 URL
outputs[].content_typestringMIME 類型(例如 image/png、video/mp4)
errorobject | null若失敗則顯示錯誤詳細資訊;成功時為 null
error.typestring機器可讀的錯誤類型代碼
error.messagestring可供人閱讀的錯誤描述

非同步流程

這個模型會非同步執行。請先送出請求,接著輪詢結果。

  1. 送出:對 /v1/run 發送 POST,並讀取回傳的 id。
  2. 輪詢:以 GET /v1/run/{id} 持續查詢,直到狀態為 completed、failed 或 timeout。
  3. 擷取:從已完成的回應中讀取 outputs。

選擇您的模型

比較模型

所有圖片與影片模型
模型類型預設價格發布時間
xAI音訊$0.01 / 次執行2026年3月17日
xAI音訊$0.02 / 次執行2026年9月16日

問題

常見問題

我要如何透過 SandBase 呼叫 xAI Text to Speech?

先建立一組 SandBase API 金鑰,接著使用模型 ID「xai/grok-tts」向 https://api.sandbase.ai 的 Unified Run API (/v1/run) 發送請求。此頁的請求範例會顯示完整的 payload。

我需要另外申請 xAI 帳號嗎?

不需要。一組 SandBase API 金鑰與餘額即可讓您存取 xAI Text to Speech 以及目錄中的其他模型;您不需要另外註冊 xAI。