Skip to content

feat(elevenlabs): stream eleven_v3/eleven_v3_conversational via text-to-dialogue - #6838

Merged
tinalenguyen merged 14 commits into
livekit:mainfrom
ameyakhare:ameya/elevenlabs-v3-dialogue-support
Aug 26, 2026
Merged

feat(elevenlabs): stream eleven_v3/eleven_v3_conversational via text-to-dialogue#6838
tinalenguyen merged 14 commits into
livekit:mainfrom
ameyakhare:ameya/elevenlabs-v3-dialogue-support

Conversation

@ameyakhare

@ameyakhare ameyakhare commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds streaming support for eleven_v3 / eleven_v3_conversational by routing them through ElevenLabs' text-to-dialogue API — the regular text-to-speech streaming websocket (multi-stream-input) rejects these models outright today, so SynthesizeStream currently fails for them.

  • ChunkedStream now posts to /v1/text-to-dialogue/stream for these models.
  • New _DialogueConnection mirrors the existing _Connection (same shared-connection, multi-context design for barge-in) but speaks text-to-dialogue's multi-stream-input protocol instead.
  • Added eleven_v3_conversational to TTSModels (eleven_v3 was already listed but non-functional for streaming).

Quickstart guide here
Websocket documentation here

Testing

  • Lint/format/mypy all pass
  • 16 new unit tests (26/26 total). Verified against the live API for both models — ChunkedStream and SynthesizeStream, including concurrent streams to simulate barge-in.

@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ameyakhare
ameyakhare force-pushed the ameya/elevenlabs-v3-dialogue-support branch from 6d0b6e6 to fa13eaa Compare August 13, 2026 03:58
@ameyakhare
ameyakhare marked this pull request as ready for review August 13, 2026 04:02
@ameyakhare
ameyakhare requested a review from a team as a code owner August 13, 2026 04:02
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@NikoLandgraf

Copy link
Copy Markdown

Keen on getting this reviewed & merged!

…s-v3-dialogue-support

Carries the new inactive-context handling from livekit#6936 into
_DialogueConnection._recv_loop (snake_case is_final, cleanup via
_cleanup_context so the turn-drain bookkeeping is released too) and tags
the dialogue loop's content-bearing log extras with lk.pii.data (livekit#6356).
devin-ai-integration[bot]

This comment was marked as resolved.

… of waiting for turn drain

The text-to-dialogue server now drains queued frames before close_context
finalizes (previously it could discard frames queued behind the close,
dropping the last turn's audio), so the client-side flush/turn-boundary
bookkeeping and deferred close tasks are no longer needed.
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@chenghao-mou chenghao-mou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Left some comments.

Comment thread livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/tts.py Outdated
- read the documented alignment field instead of normalized_alignment
  (reserved/unused on text-to-dialogue)
- send only the supported voice_settings field (stability) on the dialogue
  init packet and HTTP settings body, and warn about the dropped fields
- send a per-context keep_alive when the outgoing queue is idle so open
  contexts survive the server's 20s inactivity finalize; keep-alives stop
  once close_context is sent for a context
The server's 20s inactivity timer is per context, so an idle context must
get keep-alives even while other contexts on the connection have traffic.
Track the last send time per context and emit due keep-alives from the
send loop on both queue timeout and after each message.
@ameyakhare

Copy link
Copy Markdown
Contributor Author

Thanks for the first pass! Addressed comments

@chenghao-mou chenghao-mou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, left one more nit

@tinalenguyen

Copy link
Copy Markdown
Member

@ameyakhare thank you for the pr!!

@tinalenguyen
tinalenguyen merged commit 94808ff into livekit:main Aug 26, 2026
16 checks passed
@ameyakhare
ameyakhare deleted the ameya/elevenlabs-v3-dialogue-support branch August 26, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants