跳转到内容

Gemini 3.1 Flash Tts

集成

模型 id gemini-3.1-flash-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-3.1-flash-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.003 3 API 积分 在此页面运行

获取 API 密钥
Google 文本转语音 唇形同步快速 #lipsync#avatar

Gemini 3.1 Flash 文本转语音,支持内联风格控制、30 种声音和最多 10 位说话人

Google · 音频

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

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

构建请求

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

•必填 50 / 50000

Gemini 3.1 Flash TTS 的语音合成文本;多说话人行必须以 speakers 字段中的别名开头,例如 'Alice: Hello!\nBob: Hi!'。可以使用 [sigh]、[laughing]、[whispering] 和 [short pause] 等表现力音频标签,或使用内联自然语言指令精细控制口音、情绪、语速和风格,例如 'Say cheerfully: Have a wonderful day!'。

高级 style_instructions · output_format · voice · 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(沉稳专业)。

多语言合成语言覆盖:除非指定语言来引导模型的语音,否则会根据文本自动检测。

默认 1

语音随机性设置;较低设置下表达更集中、可预测,较高设置下表达更有创意、更加多变。

启用多说话人朗读文本不同部分的语音配置。为每位说话人分配一个语音,以及与对应提示词前缀匹配的 speaker_id 别名。

POST /run/gemini-3.1-flash-tts?wait=20 报价 → $0.003
# 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-3.1-flash-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 3.1 Flash Tts

将最多 50000 个字符的 `prompt` 转换为语音。可以通过内联指令或 `style_instructions` 控制表达方式。选择 30 种声音之一,设置 `language_code`,或使用 `speakers`(2 到 10)生成多说话人音频。输出格式为 mp3、wav 或 ogg_opus,`temperature` 范围为 0 到 2。

参数

名称类型 默认值允许值 描述
prompt必填
类型string
≤ 50,000 个字符
Gemini 3.1 Flash TTS 的语音合成文本;多说话人行必须以 speakers 字段中的别名开头,例如 'Alice: Hello!\nBob: Hi!'。可以使用 [sigh]、[laughing]、[whispering] 和 [short pause] 等表现力音频标签,或使用内联自然语言指令精细控制口音、情绪、语速和风格,例如 'Say cheerfully: Have a wonderful day!'。
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(沉稳专业)。
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)
多语言合成语言覆盖:除非指定语言来引导模型的语音,否则会根据文本自动检测。
speakers可选
类型object[]
启用多说话人朗读文本不同部分的语音配置。为每位说话人分配一个语音,以及与对应提示词前缀匹配的 speaker_id 别名。
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-3.1-flash-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": 3,
    "usd": "0.003",
    "charged": 3,
    "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-3.1-flash-tts.md. 所有模型和指南: https://doitong.com/developers/llms.txt