Pular para o conteúdo principal
POST
/
v3
/
gemini-2.5-flash-tts
Gemini 2.5 Flash TTS Texto para fala
curl --request POST \
  --url https://api.highwayapi.ai/v3/gemini-2.5-flash-tts \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "contents": {
    "role": "<string>",
    "parts": {
      "text": "<string>"
    }
  },
  "generation_config": {
    "temperature": 123,
    "speech_config": {
      "voice_config": {
        "prebuilt_voice_config": {
          "voice_name": "<string>"
        }
      },
      "language_code": "<string>",
      "multi_speaker_voice_config": {
        "speaker_voice_configs": [
          {
            "speaker": "<string>",
            "voice_config": {
              "prebuilt_voice_config": {
                "voice_name": "<string>"
              }
            }
          }
        ]
      }
    }
  }
}
'
{
  "audioContent": "<string>",
  "usageMetadata": {
    "totalTokenCount": 123,
    "promptTokenCount": 123,
    "candidatesTokenCount": 123
  }
}
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

Content-Type
string
obrigatório
Valores enumerados: application/json
Authorization
string
obrigatório
Formato de autenticação Bearer: Bearer {{API Key}}.

Corpo da solicitação

contents
object
obrigatório
generation_config
object
obrigatório

Informações da resposta

audioContent
string
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
usageMetadata
object