Model RemoteTts

ml/remote/tts::RemoteTts


Parameters

↳ const api_key: Option<string>
↳ const backend: string = "elevenlabs"
↳ const base_url: string = ""
↳ const model: string = ""
↳ const voice: string = ""


Remote text-to-speech provider configuration.

Holds the connection parameters for a remote text-to-speech service.

  • backend: provider name (default "elevenlabs"); see the table below.
  • api_key: API key for authentication (omit for unauthenticated endpoints).
  • base_url: override the provider base URL (optional).
  • model: model identifier — see the table below for recommended values per backend.
  • voice: voice identifier (required for ElevenLabs; omit for other backends).

Backends

backendapi_keyExample modelvoiceModel & voice list
"elevenlabs"ElevenLabs key"eleven_multilingual_v2"ElevenLabs voice IDhttps://elevenlabs.io/docs/text-to-speech

ℹ️ Use RemoteTts together with synthesize.

use ml/remote/tts::RemoteTts
use ml/remote/tts::synthesize

treatment example()
  model tts: RemoteTts(
    backend  = "elevenlabs",
    api_key  = "...",
    model    = "eleven_multilingual_v2",
    voice    = "JBFqnCBsd6RMkjVDRZzb"
  )
  input  text:  Stream<string>
  output audio: Stream<byte>
{
    synthesize[tts=tts]()
    Self.text -> synthesize.text,audio -> Self.audio
}