跳至內容

xAI Text to Speech

整合

模型 id xai/tts/v1
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

此請求: $0.001 1 API 點數 · ≈ ₽0.11 在此頁面執行

取得 API 金鑰

文字轉語音,提供內建語音、語言選擇和內嵌的表情語音標籤

xAI · 音訊

您的第一個結果會顯示在這裡

在下方建立請求,並使用您的 API 金鑰執行。輸出會複製到我們的儲存空間,可永久保留或免費保留 7 天。

建立請求

控制項是根據模型結構描述生成的。變更設定時,程式碼和價格會同步更新。

•必填 50 / 15000

語音合成文字,可透過行內標籤([laugh]、[pause]、[sigh])或包覆標籤(<whisper>text</whisper>、<slow>text</slow>)控制表達方式。輸入不得超過 15,000 個字元。

進階 voice · language · enable_safety_checker · output_format
預設 eve

用於語音合成的內建語音。

預設 auto

從下列 BCP-47 代碼中選擇語言:en、zh、fr、de、hi、id、it、ja、ko、pt-BR、pt-PT、ru、es-MX、es-ES、tr、vi、bn、ar-EG、ar-SA、ar-AE。若要改用自動偵測,請提供 'auto'。

生成音訊格式的設定;預設值為 MP3,取樣率為 24 kHz,位元率為 128 kbps。

POST /run/xai/tts/v1?wait=20 報價 → $0.001
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/xai/tts/v1?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from Doitong. This is a short test sentence."
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

執行此請求

您的金鑰會保留在此瀏覽器中:只會傳送至 Doitong API,且只有在勾選「記住」時才會儲存至 localStorage。 取得 API 金鑰

關於 xAI Text to Speech

將最多 15,000 個字元的文字轉換為語音。可從 28 種內建語音中選擇,並指定語言代碼或自動偵測。文字可包含 [laugh]、[pause] 和 [sigh] 等標籤,或使用 <whisper> 和 <slow> 等包覆標籤,以呈現富表情的語氣。`output_format` 可設定音訊檔案格式。

參數

名稱類型 預設值允許值 說明
text必填
類型string
≤ 15,000 個字元
語音合成文字,可透過行內標籤([laugh]、[pause]、[sigh])或包覆標籤(<whisper>text</whisper>、<slow>text</slow>)控制表達方式。輸入不得超過 15,000 個字元。
voice選填
類型enum
預設值eve
carinazaganhelixorionlunairisaltairzenithperseusheliosluxkeplerrigelcosmocelesteursa
另有 12 個siriuslumencastornakshatlasauroralioraaraeveleorexsal
用於語音合成的內建語音。
language選填
類型enum
預設值auto
autoenar-EGar-SAar-AEbnzhfrdehiiditjakopt-BRpt-PT
另有 5 個rues-MXes-EStrvi
從下列 BCP-47 代碼中選擇語言:en、zh、fr、de、hi、id、it、ja、ko、pt-BR、pt-PT、ru、es-MX、es-ES、tr、vi、bn、ar-EG、ar-SA、ar-AE。若要改用自動偵測,請提供 'auto'。
output_format選填
類型object
生成音訊格式的設定;預設值為 MP3,取樣率為 24 kHz,位元率為 128 kbps。
output_format.codec選填
類型enum
預設值mp3
mp3wavpcmmulawalaw
音訊編碼的編解碼器;可用選項為 mp3、wav、pcm、mulaw、alaw。
output_format.sample_rate選填
類型enum
預設值24000
80001600022050240004410048000
音訊取樣頻率,以 Hz 為單位。
output_format.bit_rate選填
類型enum
320006400096000128000192000
MP3 輸出的位元率,預設值為 128000,單位為 bps;不適用於其他編解碼器。
enable_safety_checker選填
類型boolean
預設值true
在呼叫端獲得授權的情況下,將此值設為 false 可放寬審核。
必填

輸出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "xai/tts/v1",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 1,
    "usd": "0.001",
    "charged": 1,
    "refunded": 0
  },
  "input": {
    "text": "Hello from Doitong. This is a short test sentence."
  },
  "output": {
    "audio": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_name": "0-output.mp3",
      "file_size": 1843200
    }
  },
  "outputs": [
    {
      "type": "audio",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.mp3",
      "content_type": "audio/mpeg",
      "file_size": 1843200,
      "duration": 12,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
您的檔案,由您選擇每個 outputs[].url 都是儲存空間中的副本:可永久保留(按 GB-月計費),或免費保留 7 天;可透過帳戶設定或 ?storage= 設定。
所有模型使用相同結構圖片、影片和音訊皆包含 type、url、content_type、width、height 和 duration。output 是模型自己的結果物件。
輸出欄位
audio
object {url, content_type, file_name, file_size}生成產生的音訊檔案。

給 AI 代理程式:此頁面的 Markdown 位於 https://doitong.com/zh-TW/developers/models/xai/tts/v1.md. 所有模型與指南: https://doitong.com/developers/llms.txt