> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jiekou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 2.5 Flash TTS Text-to-Speech

Convierte texto en voz mediante la interfaz generateContent de Vertex AI. El formato del cuerpo de la solicitud es totalmente coherente con la API oficial de Vertex AI. Admite dos modos: síncrono (una solicitud, una respuesta) y streaming (una solicitud, respuesta en streaming). La salida está en formato LINEAR16 PCM (24kHz, mono, 16-bit signed little-endian) y no incluye encabezado WAV.

## Encabezados de solicitud

<ParamField header="Content-Type" type="string" required={true}>
  Valores enumerados: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Formato de autenticación Bearer: Bearer \{\{API Key}}.
</ParamField>

## Cuerpo de la solicitud

<ParamField body="contents" type="object" required={true}>
  <Expandable title="properties" defaultOpen={true}>
    <ParamField body="role" type="string" required={true} default="user">
      Rol, fijo como user

      Valores opcionales: `user`
    </ParamField>

    <ParamField body="parts" type="object" required={true}>
      <Expandable title="properties" defaultOpen={true}>
        <ParamField body="text" type="string" required={true}>
          Contenido de texto que se sintetizará como voz. La API de Vertex AI combina el prompt y el texto en un solo campo, con el formato '{prompt}: {text}', por ejemplo: 'Say the following in a curious way: OK, so... tell me about this AI thing.'. El tamaño total es de hasta 8000 bytes; el audio que supere los 655 segundos se truncará. Admite etiquetas de marcado en línea: \[sigh], \[laughing], \[uhm], \[sarcasm], \[robotic], \[shouting], \[whispering], \[extremely fast], \[short pause], \[medium pause], \[long pause]

          Límite de longitud: 0 - 8000
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="generation_config" type="object" required={true}>
  <Expandable title="properties" defaultOpen={true}>
    <ParamField body="temperature" type="number" default={2}>
      Parámetro de temperatura, controla la aleatoriedad y creatividad de la generación de voz. Cuanto mayor sea el valor, más creativa y diversa será; cuanto menor sea, más predecible y enfocada. Rango válido (0.0, 2.0]; el valor recomendado es 2.0

      Rango de valores: \[0, 2]
    </ParamField>

    <ParamField body="speech_config" type="object" required={true}>
      <Expandable title="properties" defaultOpen={true}>
        <ParamField body="voice_config" type="object">
          Configuración de voz de una sola persona. Elige una de las dos opciones junto con multi\_speaker\_voice\_config

          <Expandable title="properties" defaultOpen={true}>
            <ParamField body="prebuilt_voice_config" type="object">
              <Expandable title="properties" defaultOpen={true}>
                <ParamField body="voice_name" type="string">
                  Nombre de voz predefinida (no distingue mayúsculas y minúsculas). 30 voces opcionales disponibles (incluye voces masculinas y femeninas)

                  Valores opcionales: `Achernar`, `Achird`, `Algenib`, `Algieba`, `Alnilam`, `Aoede`, `Autonoe`, `Callirrhoe`, `Charon`, `Despina`, `Enceladus`, `Erinome`, `Fenrir`, `Gacrux`, `Iapetus`, `Kore`, `Laomedeia`, `Leda`, `Orus`, `Pulcherrima`, `Puck`, `Rasalgethi`, `Sadachbia`, `Sadaltager`, `Schedar`, `Sulafat`, `Umbriel`, `Vindemiatrix`, `Zephyr`, `Zubenelgenubi`
                </ParamField>
              </Expandable>
            </ParamField>
          </Expandable>
        </ParamField>

        <ParamField body="language_code" type="string" required={true}>
          Código de idioma (formato BCP-47, no distingue mayúsculas y minúsculas). Idiomas GA: ar-EG, bn-BD, nl-NL, en-IN, en-US, fr-FR, de-DE, hi-IN, id-ID, it-IT, ja-JP, ko-KR, mr-IN, pl-PL, pt-BR, ro-RO, ru-RU, es-ES, ta-IN, te-IN, th-TH, tr-TR, uk-UA, vi-VN. Los idiomas Preview incluyen cmn-CN (chino mandarín) y otros 63

          Valores opcionales: `af-ZA`, `am-ET`, `ar-001`, `ar-EG`, `az-AZ`, `be-BY`, `bg-BG`, `bn-BD`, `ca-ES`, `ceb-PH`, `cmn-CN`, `cmn-TW`, `cs-CZ`, `da-DK`, `de-DE`, `el-GR`, `en-AU`, `en-GB`, `en-IN`, `en-US`, `es-419`, `es-ES`, `es-MX`, `et-EE`, `eu-ES`, `fa-IR`, `fi-FI`, `fil-PH`, `fr-CA`, `fr-FR`, `gl-ES`, `gu-IN`, `he-IL`, `hi-IN`, `hr-HR`, `ht-HT`, `hu-HU`, `hy-AM`, `id-ID`, `is-IS`, `it-IT`, `ja-JP`, `jv-JV`, `ka-GE`, `kn-IN`, `ko-KR`, `kok-IN`, `la-VA`, `lb-LU`, `lo-LA`, `lt-LT`, `lv-LV`, `mai-IN`, `mg-MG`, `mk-MK`, `ml-IN`, `mn-MN`, `mr-IN`, `ms-MY`, `my-MM`, `nb-NO`, `ne-NP`, `nl-NL`, `nn-NO`, `or-IN`, `pa-IN`, `pl-PL`, `ps-AF`, `pt-BR`, `pt-PT`, `ro-RO`, `ru-RU`, `sd-IN`, `si-LK`, `sk-SK`, `sl-SI`, `sq-AL`, `sr-RS`, `sv-SE`, `sw-KE`, `ta-IN`, `te-IN`, `th-TH`, `tr-TR`, `uk-UA`, `ur-PK`, `vi-VN`
        </ParamField>

        <ParamField body="multi_speaker_voice_config" type="object">
          Configuración de voz de múltiples personas. Elige una de las dos opciones junto con voice\_config. Nota: gemini-2.5-flash-lite-preview-tts no admite síntesis de múltiples personas

          <Expandable title="properties" defaultOpen={true}>
            <ParamField body="speaker_voice_configs" type="object[]">
              Lista de configuraciones de voces de hablantes

              <Expandable title="properties" defaultOpen={true}>
                <ParamField body="speaker" type="string" required={true}>
                  Alias del hablante; debe constar únicamente de caracteres alfanuméricos y no contener espacios. Debe coincidir con el identificador de hablante en contents.parts.text
                </ParamField>

                <ParamField body="voice_config" type="object" required={true}>
                  <Expandable title="properties" defaultOpen={true}>
                    <ParamField body="prebuilt_voice_config" type="object">
                      <Expandable title="properties" defaultOpen={true}>
                        <ParamField body="voice_name" type="string">
                          Nombre de voz predefinida (no distingue mayúsculas y minúsculas). 30 voces opcionales disponibles (incluye voces masculinas y femeninas)

                          Valores opcionales: `Achernar`, `Achird`, `Algenib`, `Algieba`, `Alnilam`, `Aoede`, `Autonoe`, `Callirrhoe`, `Charon`, `Despina`, `Enceladus`, `Erinome`, `Fenrir`, `Gacrux`, `Iapetus`, `Kore`, `Laomedeia`, `Leda`, `Orus`, `Pulcherrima`, `Puck`, `Rasalgethi`, `Sadachbia`, `Sadaltager`, `Schedar`, `Sulafat`, `Umbriel`, `Vindemiatrix`, `Zephyr`, `Zubenelgenubi`
                        </ParamField>
                      </Expandable>
                    </ParamField>
                  </Expandable>
                </ParamField>
              </Expandable>
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## Información de respuesta

<ResponseField name="audioContent" type="string" required={false}>
  Contenido de audio codificado en Base64. El formato es LINEAR16 PCM (24kHz, mono, 16-bit signed little-endian) y no incluye encabezado WAV. El cliente puede convertirlo usando ffmpeg: ffmpeg -f s16le -ar 24k -ac 1 -i input.raw output.wav
</ResponseField>

<ResponseField name="usageMetadata" type="object" required={false}>
  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="totalTokenCount" type="integer" required={false}>
      Número total de tokens (promptTokenCount + candidatesTokenCount)
    </ResponseField>

    <ResponseField name="promptTokenCount" type="integer" required={false}>
      Número de tokens consumidos por el texto de entrada
    </ResponseField>

    <ResponseField name="candidatesTokenCount" type="integer" required={false}>
      Número de tokens consumidos por el audio de salida (aproximadamente 25 tokens por segundo de audio)
    </ResponseField>
  </Expandable>
</ResponseField>
