Class ElevenLabsVoicesApi
java.lang.Object
org.springframework.ai.elevenlabs.api.ElevenLabsVoicesApi
Client for the ElevenLabs Voices API.
- Author:
- Alexandros Pappas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder to constructElevenLabsVoicesApiinstance.static enumstatic final recordstatic final recordstatic final recordstatic final recordstatic final recordstatic enumstatic final recordstatic final recordstatic final recordstatic final recordRepresents a single voice from the ElevenLabs API.static final recordRepresents the response from the /v1/voices endpoint.static final recordstatic final recordstatic final recordstatic final record -
Constructor Summary
ConstructorsConstructorDescriptionElevenLabsVoicesApi(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.ElevenLabsVoicesApi(org.springframework.web.client.RestClient restClient) Create a new ElevenLabs Voices API client. -
Method Summary
Modifier and TypeMethodDescriptionstatic ElevenLabsVoicesApi.Builderbuilder()org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.VoiceSettings> Gets the default settings for voices.org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.Voice> Returns metadata about a specific voice.org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.Voices> Retrieves a list of all available voices from the ElevenLabs API.org.springframework.http.ResponseEntity<ElevenLabsVoicesApi.VoiceSettings> getVoiceSettings(String voiceId) Returns the settings for a specific voice.
-
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
-
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:
ResponseEntitycontaining theElevenLabsVoicesApi.VoiceSettingsrecord.
-
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:
ResponseEntitycontaining theElevenLabsVoicesApi.VoiceSettingsrecord.
-
getVoice
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:
ResponseEntitycontaining theElevenLabsVoicesApi.Voicerecord.
-