Class: RunApi::Elevenlabs::Client

Inherits:
Core::Client
  • Object
show all
Defined in:
lib/runapi/elevenlabs/client.rb

Overview

ElevenLabs audio API client for speech synthesis, multi-speaker dialogue, sound effects, transcription, and vocal isolation.

Examples:

client = RunApi::Elevenlabs::Client.new(api_key: "sk-...")
result = client.text_to_speech.run(
  model: "text-to-speech-turbo-v2.5",
  text: "Hello, world!"
)
puts result.audios.first.url

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Returns a new instance of Client.



27
28
29
30
31
32
33
34
35
# File 'lib/runapi/elevenlabs/client.rb', line 27

def initialize(api_key: nil, **options)
  super

  @text_to_speech = Resources::TextToSpeech.new(http)
  @text_to_dialogue = Resources::TextToDialogue.new(http)
  @text_to_sound = Resources::TextToSound.new(http)
  @speech_to_text = Resources::SpeechToText.new(http)
  @isolate_audio = Resources::IsolateAudio.new(http)
end

Instance Attribute Details

#isolate_audioResources::IsolateAudio (readonly)

Returns Vocal isolation operations.

Returns:



25
26
27
# File 'lib/runapi/elevenlabs/client.rb', line 25

def isolate_audio
  @isolate_audio
end

#speech_to_textResources::SpeechToText (readonly)

Returns Audio transcription operations.

Returns:



23
24
25
# File 'lib/runapi/elevenlabs/client.rb', line 23

def speech_to_text
  @speech_to_text
end

#text_to_dialogueResources::TextToDialogue (readonly)

Returns Multi-speaker dialogue synthesis operations.

Returns:



19
20
21
# File 'lib/runapi/elevenlabs/client.rb', line 19

def text_to_dialogue
  @text_to_dialogue
end

#text_to_soundResources::TextToSound (readonly)

Returns Sound effect generation operations.

Returns:



21
22
23
# File 'lib/runapi/elevenlabs/client.rb', line 21

def text_to_sound
  @text_to_sound
end

#text_to_speechResources::TextToSpeech (readonly)

Returns Single-speaker speech synthesis operations.

Returns:



17
18
19
# File 'lib/runapi/elevenlabs/client.rb', line 17

def text_to_speech
  @text_to_speech
end