跳转到内容

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-CN/developers/models/gemini-tts.md. 所有模型和指南: https://doitong.com/developers/llms.txt