跳转到内容

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.com/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.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

此请求: ≈$0.03 30 API 积分 在此页面运行

获取 API 密钥
Google 文本转语音 #text-to-speech#audio#gemini

文本转语音模型,支持 30 种声音、多说话人对话、风格指令,以及 Flash 或 Pro 模型选择

Google · 音频

你的第一个结果将在此显示

在下方构建请求,并使用你的 API 密钥运行。输出会复制到我们的存储中,可永久保存或免费保存 7 天。

构建请求

控件根据模型架构生成。更改控件时,代码和价格会同步更新。

•必填 50 / 50000

Gemini TTS 的语音文本,支持嵌入式自然语言风格、语速、口音和情绪指令,例如 '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 模型选择。在有声书、播客或客户支持等结构化工作流中,要获得最高质量,请使用 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.com/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.com/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 的语音文本,支持嵌入式自然语言风格、语速、口音和情绪指令,例如 '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 模型选择。在有声书、播客或客户支持等结构化工作流中,要获得最高质量,请使用 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.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/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/developers/models/gemini-tts.md. 所有模型和指南: https://doitong.com/developers/llms.txt