跳至內容

Gemini TTS

整合

模型 id gemini-tts
# 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/gemini-tts?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "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.03 30 API 點數 · ≈ ₽3.14 在此頁面執行

取得 API 金鑰
Google 文字轉語音 #text-to-speech#audio#gemini

文字轉語音,支援 30 種語音、多說話者對話、風格指示,以及 Flash 或 Pro 模型選擇

Google · 音訊

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

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

建立請求

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

•必填 50 / 50000

Gemini TTS 的語音文字,可嵌入 style、語速、口音和情緒的自然語言指示,例如 'Say cheerfully: Have a wonderful day!'。包含 [slowly]、[whispering]、[excited] 和 [extremely fast] 的內嵌標記也可控制語速與風格。多位說話者的行必須以 speakers 欄位中的別名開頭,例如 'Alice: Hello!\nBob: Hi!'。

進階 style_instructions · output_format · voice · model · language_code · temperature · speakers
0 / 4000

與口述內容分開保留、並插入提示詞前方以塑造表達力、口音、語速、語調和情緒的可選自然語言指示。範例包括 'Speak warmly and slowly'、'Read this as a dramatic newscast'、'Use a British accent with a cheerful tone' 和 'Whisper mysteriously'。

output_format 預設 mp3

輸出音訊格式:mp3 提供壓縮且精簡的檔案,建議使用;wav 在 WAV 容器中包含 24 kHz、16 位元單聲道的未壓縮 PCM 音訊;ogg_opus 在 Ogg 中使用 Opus,兼顧品質與大小。

預設 Kore

從 30 種不同預設中選取單一說話者的聲音;設定 speakers 後,此選擇會停用。熱門女性選項包括 Kore(強勁堅定)、Zephyr(明亮清晰)和 Aoede(溫暖旋律);熱門男性選項包括 Puck(活潑有朝氣)和 Charon(沉穩專業)。

預設 gemini-2.5-flash-tts

Gemini TTS 模型選擇。在有聲書、Podcast 或客戶支援等結構化工作流程中,若要獲得最高品質,請使用 gemini-2.5-pro-tts。

多語言合成的語音語言:省略此值可讓模型從文字推斷語言,或提供此值以引導口述輸出。Preview 支援 60+ 種語言,GA 支援 24 種。

預設 1

語音隨機性設定;較低設定產生集中且可預測的語音,較高設定產生創意且多變的語音。

gemini-2.5-pro-tts 和 gemini-2.5-flash-tts 支援的說話者設定,但 gemini-2.5-flash-lite-preview-tts 不支援。提供此設定可讓不同聲音朗讀不同文字段落;為每位說話者提供聲音及與其提示詞前綴相符的 speaker_id 別名。

POST /run/gemini-tts?wait=20 報價 → $0.03
# 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/gemini-tts?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "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 金鑰

關於 Gemini TTS

將最多 50,000 個字元的文字轉為語音。選擇 `voice`,以及 `model` gemini-2.5-flash-tts 或 gemini-2.5-pro-tts。`style_instructions`(最多 4000 個字元)控制語氣,`speakers` 可接收 2 到 10 個項目以生成多語音稿件。可選擇 `language_code`、0 到 2 的 `temperature`,以及 wav、mp3 或 ogg_opus 輸出。

參數

名稱類型 預設值允許值 說明
prompt必填
類型string
≤ 50,000 個字元
Gemini TTS 的語音文字,可嵌入 style、語速、口音和情緒的自然語言指示,例如 'Say cheerfully: Have a wonderful day!'。包含 [slowly]、[whispering]、[excited] 和 [extremely fast] 的內嵌標記也可控制語速與風格。多位說話者的行必須以 speakers 欄位中的別名開頭,例如 'Alice: Hello!\nBob: Hi!'。
style_instructions選填
類型string | null
≤ 4,000 個字元
與口述內容分開保留、並插入提示詞前方以塑造表達力、口音、語速、語調和情緒的可選自然語言指示。範例包括 'Speak warmly and slowly'、'Read this as a dramatic newscast'、'Use a British accent with a cheerful tone' 和 'Whisper mysteriously'。
voice選填
類型enum
預設值Kore
AchernarAchirdAlgenibAlgiebaAlnilamAoedeAutonoeCallirrhoeCharonDespinaEnceladusErinomeFenrirGacruxIapetusKore
另有 14 個LaomedeiaLedaOrusPulcherrimaPuckRasalgethiSadachbiaSadaltagerSchedarSulafatUmbrielVindemiatrixZephyrZubenelgenubi
從 30 種不同預設中選取單一說話者的聲音;設定 speakers 後,此選擇會停用。熱門女性選項包括 Kore(強勁堅定)、Zephyr(明亮清晰)和 Aoede(溫暖旋律);熱門男性選項包括 Puck(活潑有朝氣)和 Charon(沉穩專業)。
model選填
類型enum
預設值gemini-2.5-flash-tts
gemini-2.5-flash-ttsgemini-2.5-pro-tts
Gemini TTS 模型選擇。在有聲書、Podcast 或客戶支援等結構化工作流程中,若要獲得最高品質,請使用 gemini-2.5-pro-tts。
language_code選填
類型enum
Arabic (Egypt)Bangla (Bangladesh)Dutch (Netherlands)English (India)English (US)French (France)German (Germany)Hindi (India)Indonesian (Indonesia)Italian (Italy)Japanese (Japan)Korean (South Korea)Marathi (India)Polish (Poland)Portuguese (Brazil)Romanian (Romania)
另有 71 個Russian (Russia)Spanish (Spain)Tamil (India)Telugu (India)Thai (Thailand)Turkish (Turkey)Ukrainian (Ukraine)Vietnamese (Vietnam)Afrikaans (South Africa)Albanian (Albania)Amharic (Ethiopia)Arabic (World)Armenian (Armenia)Azerbaijani (Azerbaijan)Basque (Spain)Belarusian (Belarus)Bulgarian (Bulgaria)Burmese (Myanmar)Catalan (Spain)Cebuano (Philippines)Chinese Mandarin (China)Chinese Mandarin (Taiwan)Croatian (Croatia)Czech (Czech Republic)Danish (Denmark)English (Australia)English (UK)Estonian (Estonia)Filipino (Philippines)Finnish (Finland)French (Canada)Galician (Spain)Georgian (Georgia)Greek (Greece)Gujarati (India)Haitian Creole (Haiti)Hebrew (Israel)Hungarian (Hungary)Icelandic (Iceland)Javanese (Java)Kannada (India)Konkani (India)Lao (Laos)Latin (Vatican City)Latvian (Latvia)Lithuanian (Lithuania)Luxembourgish (Luxembourg)Macedonian (North Macedonia)Maithili (India)Malagasy (Madagascar)Malay (Malaysia)Malayalam (India)Mongolian (Mongolia)Nepali (Nepal)Norwegian Bokmal (Norway)Norwegian Nynorsk (Norway)Odia (India)Pashto (Afghanistan)Persian (Iran)Portuguese (Portugal)Punjabi (India)Serbian (Serbia)Sindhi (India)Sinhala (Sri Lanka)Slovak (Slovakia)Slovenian (Slovenia)Spanish (Latin America)Spanish (Mexico)Swahili (Kenya)Swedish (Sweden)Urdu (Pakistan)
多語言合成的語音語言:省略此值可讓模型從文字推斷語言,或提供此值以引導口述輸出。Preview 支援 60+ 種語言,GA 支援 24 種。
speakers選填
類型object[]
≤ 10 個項目≥ 2 個項目
gemini-2.5-pro-tts 和 gemini-2.5-flash-tts 支援的說話者設定,但 gemini-2.5-flash-lite-preview-tts 不支援。提供此設定可讓不同聲音朗讀不同文字段落;為每位說話者提供聲音及與其提示詞前綴相符的 speaker_id 別名。
speakers[].voice必填
類型enum
AchernarAchirdAlgenibAlgiebaAlnilamAoedeAutonoeCallirrhoeCharonDespinaEnceladusErinomeFenrirGacruxIapetusKore
另有 14 個LaomedeiaLedaOrusPulcherrimaPuckRasalgethiSadachbiaSadaltagerSchedarSulafatUmbrielVindemiatrixZephyrZubenelgenubi
指定給此說話者的預設聲音。
speakers[].speaker_id必填
類型string
僅包含英數字元且不含空白的說話者別名。以此別名作為提示文字前綴來識別說話者,例如 'Alice: Hello! Bob: Hi there!'。
temperature選填
類型number
預設值1
0 – 2
語音隨機性設定;較低設定產生集中且可預測的語音,較高設定產生創意且多變的語音。
output_format選填
類型enum
預設值mp3
wavmp3ogg_opus
輸出音訊格式:mp3 提供壓縮且精簡的檔案,建議使用;wav 在 WAV 容器中包含 24 kHz、16 位元單聲道的未壓縮 PCM 音訊;ogg_opus 在 Ogg 中使用 Opus,兼顧品質與大小。
必填

輸出

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "gemini-tts",
  "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": 30,
    "usd": "0.03",
    "charged": 30,
    "refunded": 0
  },
  "input": {
    "prompt": "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/gemini-tts.md. 所有模型與指南: https://doitong.com/developers/llms.txt