Class ElevenLabsApi
java.lang.Object
org.springframework.ai.elevenlabs.api.ElevenLabsApi
Client for the ElevenLabs Text-to-Speech API.
- Author:
- Alexandros Pappas
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder to constructElevenLabsApiinstance.static enumThe output format of the generated audio.static final recordRepresents a request to the ElevenLabs Text-to-Speech API. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ElevenLabsApi.Builderbuilder()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.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.
-
Field Details
-
DEFAULT_BASE_URL
- See Also:
-
-
Method Details
-
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.
-