Saltar al contenido principal
POST
/
v3
/
gemini-2.5-flash-tts
Gemini 2.5 Flash TTS Text-to-Speech
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
  }
}
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

Content-Type
string
requerido
Valores enumerados: application/json
Authorization
string
requerido
Formato de autenticación Bearer: Bearer {{API Key}}.

Cuerpo de la solicitud

contents
object
requerido
generation_config
object
requerido

Información de respuesta

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