Text To Speech Api
Generates speech from complete or incrementally produced text.
Functions
Link copied to clipboard
Generates a complete audio response for request.
Link copied to clipboard
abstract suspend fun openRealtimeSession(voiceId: String, options: RealtimeTtsOptions = RealtimeTtsOptions(), authorization: RealtimeTtsAuthorization = RealtimeTtsAuthorization.ConfiguredApiKey): RealtimeTtsSession
Opens a controllable realtime text-to-speech session for voiceId.
Link copied to clipboard
abstract fun realtime(voiceId: String, text: Flow<String>, options: RealtimeTtsOptions = RealtimeTtsOptions(), authorization: RealtimeTtsAuthorization = RealtimeTtsAuthorization.ConfiguredApiKey): Flow<AudioChunk>
Streams partial text input to ElevenLabs and emits audio as it becomes available. The returned flow is cold and opens a new realtime session for each collection. Empty input values are ignored, and normal input completion gracefully finishes the session.
Link copied to clipboard
Performs HTTP response streaming. The returned flow is cold and each collection starts a new request. Cancelling collection closes the underlying response. Each emitted AudioChunk is an arbitrary transport chunk, not necessarily a codec frame.