Class ElevenLabsApi

java.lang.Object
org.springframework.ai.elevenlabs.api.ElevenLabsApi

public final class ElevenLabsApi extends Object
Client for the ElevenLabs Text-to-Speech API.
Author:
Alexandros Pappas
  • Field Details

  • Method Details

    • builder

      public static ElevenLabsApi.Builder builder()
    • textToSpeech

      public org.springframework.http.ResponseEntity<byte[]> textToSpeech(ElevenLabsApi.SpeechRequest requestBody, String voiceId, org.springframework.util.MultiValueMap<String,String> queryParameters)
      Convert text to speech using the specified voice and parameters.
      Parameters:
      requestBody - The request body containing text, model, and voice settings.
      voiceId - The ID of the voice to use. Must not be null.
      queryParameters - Additional query parameters for the API call.
      Returns:
      A ResponseEntity containing the generated audio as a byte array.
    • textToSpeechStream

      public reactor.core.publisher.Flux<org.springframework.http.ResponseEntity<byte[]>> textToSpeechStream(ElevenLabsApi.SpeechRequest requestBody, String voiceId, org.springframework.util.MultiValueMap<String,String> queryParameters)
      Convert text to speech using the specified voice and parameters, streaming the results.
      Parameters:
      requestBody - The request body containing text, model, and voice settings.
      voiceId - The ID of the voice to use. Must not be null.
      queryParameters - Additional query parameters for the API call.
      Returns:
      A Flux of ResponseEntity containing the generated audio chunks as byte arrays.