> ## 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 Texto para fala

Converte texto em fala com base na interface generateContent do Vertex AI. O formato do corpo da solicitação é totalmente consistente com a API oficial do Vertex AI. Oferece suporte a dois modos: síncrono (uma solicitação, uma resposta) e streaming (uma solicitação, resposta em streaming). A saída está no formato LINEAR16 PCM (24kHz, mono, 16-bit signed little-endian), sem cabeçalho WAV.

## Cabeçalhos da solicitação

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

<ParamField header="Authorization" type="string" required={true}>
  Formato de autenticação Bearer: Bearer \{\{API Key}}.
</ParamField>

## Corpo da solicitação

<ParamField body="contents" type="object" required={true}>
  <Expandable title="properties" defaultOpen={true}>
    <ParamField body="role" type="string" required={true} default="user">
      Função, fixa como user

      Valores opcionais: `user`
    </ParamField>

    <ParamField body="parts" type="object" required={true}>
      <Expandable title="properties" defaultOpen={true}>
        <ParamField body="text" type="string" required={true}>
          Conteúdo de texto a ser sintetizado em fala. A API Vertex AI combina o prompt e o texto em um único campo, no formato '{prompt}: {text}', por exemplo, 'Say the following in a curious way: OK, so... tell me about this AI thing.'. O tamanho total é de no máximo 8000 bytes; áudios que excederem 655 segundos serão truncados. Oferece suporte a tags de marcação inline: \[sigh]、\[laughing]、\[uhm]、\[sarcasm]、\[robotic]、\[shouting]、\[whispering]、\[extremely fast]、\[short pause]、\[medium pause]、\[long pause]

          Limite de comprimento: 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 a aleatoriedade e a criatividade da geração de fala. Valores mais altos geram mais criatividade e diversidade; valores mais baixos são mais previsíveis e focados. Intervalo válido (0.0, 2.0], valor recomendado 2.0

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

    <ParamField body="speech_config" type="object" required={true}>
      <Expandable title="properties" defaultOpen={true}>
        <ParamField body="voice_config" type="object">
          Configuração de fala para uma pessoa. Escolha uma entre esta e 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">
                  Nome da voz predefinida (sem diferenciação entre maiúsculas e minúsculas). 30 vozes disponíveis (inclui vozes masculinas e femininas)

                  Valores opcionais: `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, sem diferenciação entre maiúsculas e 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. Idiomas Preview incluem cmn-CN (chinês mandarim) e outros 63

          Valores opcionais: `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">
          Configuração de fala para múltiplas pessoas. Escolha uma entre esta e voice\_config. Observação: gemini-2.5-flash-lite-preview-tts não oferece suporte à síntese com múltiplas pessoas

          <Expandable title="properties" defaultOpen={true}>
            <ParamField body="speaker_voice_configs" type="object[]">
              Lista de configurações de voz dos falantes

              <Expandable title="properties" defaultOpen={true}>
                <ParamField body="speaker" type="string" required={true}>
                  Alias do falante, deve ser composto apenas por caracteres alfanuméricos, sem espaços. Deve corresponder ao identificador do falante em 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">
                          Nome da voz predefinida (sem diferenciação entre maiúsculas e minúsculas). 30 vozes disponíveis (inclui vozes masculinas e femininas)

                          Valores opcionais: `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>

## Informações da resposta

<ResponseField name="audioContent" type="string" required={false}>
  Conteúdo de áudio codificado em Base64. O formato é LINEAR16 PCM (24kHz, mono, 16-bit signed little-endian), sem cabeçalho WAV. O cliente pode usar ffmpeg para converter: 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 pelo texto de entrada
    </ResponseField>

    <ResponseField name="candidatesTokenCount" type="integer" required={false}>
      Número de tokens consumidos pelo áudio de saída (aproximadamente 25 tokens por segundo de áudio)
    </ResponseField>
  </Expandable>
</ResponseField>
