Zum Hauptinhalt springen
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
  }
}
Konvertiert Text über die Vertex AI generateContent-Schnittstelle in Sprache. Das Format des Request-Bodys ist vollständig identisch mit der offiziellen Vertex AI API. Unterstützt sowohl den synchronen Modus (eine Anfrage, eine Antwort) als auch den Streaming-Modus (eine Anfrage, Streaming-Antwort). Die Ausgabe erfolgt im LINEAR16-PCM-Format (24kHz, Mono, 16-bit signed little-endian) und enthält keinen WAV-Header.

Request-Header

Content-Type
string
erforderlich
Enumerationswert: application/json
Authorization
string
erforderlich
Format der Bearer-Authentifizierung: Bearer {{API Key}}.

Request-Body

contents
object
erforderlich
generation_config
object
erforderlich

Antwortinformationen

audioContent
string
Base64-codierter Audioinhalt. Format: LINEAR16 PCM (24kHz, Mono, 16-bit signed little-endian), ohne WAV-Header. Clients können ffmpeg zur Konvertierung verwenden: ffmpeg -f s16le -ar 24k -ac 1 -i input.raw output.wav
usageMetadata
object