Class ElevenLabsVoicesApi

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

public class ElevenLabsVoicesApi extends Object
Client for the ElevenLabs Voices API.
Author:
Alexandros Pappas
  • Constructor Details

    • ElevenLabsVoicesApi

      public ElevenLabsVoicesApi(String baseUrl, ApiKey apiKey, org.springframework.http.HttpHeaders headers, org.springframework.web.client.RestClient.Builder restClientBuilder, org.springframework.web.client.ResponseErrorHandler responseErrorHandler)
      Create a new ElevenLabs Voices API client.
      Parameters:
      baseUrl - The base URL for the ElevenLabs API.
      apiKey - Your ElevenLabs API key.
      headers - the http headers to use.
      restClientBuilder - A builder for the Spring RestClient.
      responseErrorHandler - A custom error handler for API responses.
    • ElevenLabsVoicesApi

      public ElevenLabsVoicesApi(org.springframework.web.client.RestClient restClient)
      Create a new ElevenLabs Voices API client.
      Parameters:
      restClient - Spring RestClient instance.
  • Method Details

    • builder

      public static ElevenLabsVoicesApi.Builder builder()
    • getVoices

      public org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.Voices> getVoices()
      Retrieves a list of all available voices from the ElevenLabs API.
      Returns:
      A ResponseEntity containing a Voices object, which contains the list of voices.
    • getDefaultVoiceSettings

      public org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.VoiceSettings> getDefaultVoiceSettings()
      Gets the default settings for voices. "similarity_boost" corresponds to ”Clarity + Similarity Enhancement” in the web app and "stability" corresponds to "Stability" slider in the web app.
      Returns:
      ResponseEntity containing the ElevenLabsVoicesApi.VoiceSettings record.
    • getVoiceSettings

      public org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.VoiceSettings> getVoiceSettings(String voiceId)
      Returns the settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to the "Stability" slider in the web app.
      Parameters:
      voiceId - The ID of the voice to get settings for. Required.
      Returns:
      ResponseEntity containing the ElevenLabsVoicesApi.VoiceSettings record.
    • getVoice

      public org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.Voice> getVoice(String voiceId)
      Returns metadata about a specific voice.
      Parameters:
      voiceId - ID of the voice to be used. You can use the Get voices endpoint list all the available voices. Required.
      Returns:
      ResponseEntity containing the ElevenLabsVoicesApi.Voice record.