Skip to content

feat(vartaloop): add livekit-plugins-vartaloop TTS plugin - #8449

Open
roshanpuru wants to merge 17 commits into
livekit:mainfrom
vartalaap-si:vartaloop-tts
Open

roshanpuru wants to merge 17 commits into
livekit:mainfrom
vartalaap-si:vartaloop-tts

Conversation

@roshanpuru

Copy link
Copy Markdown

Summary

Adds livekit-plugins-vartaloop, a TTS plugin for Vartaloop, a Hinglish and Indian-language text-to-speech API (24 kHz pcm16, first audio after the first 80 ms frame).

  • ChunkedStream (synthesize()): POST /v1/tts, the chunked PCM body is forwarded as it arrives.
  • SynthesizeStream (stream()): a pooled WS /v1/tts/stream connection (utils.ConnectionPool, 5 min sessions, prewarm()). Text is cut into sentences as it is pushed (tokenize.basic.SentenceTokenizer, which ends sentences on the Devanagari danda too) and every sentence is sent at once as its own utterance; the server serves them in order and streams each one's audio back, so the next sentence is synthesised while the current one plays. Events and audio of other utterances left on a pooled socket are ignored.
  • Every server parameter is a constructor option and an update_options() keyword: voice, expression (the API's style), digits, speed, temperature, seed, postfx, profile, raw; they travel in each utterance's body, so updates apply from the next sentence without reconnecting.
  • 503 (busy, Retry-After) and 5xx are retryable APIStatusErrors, 4xx are not; handshake errors never carry the key.
  • tests/test_plugin_vartaloop_tts.py (pytest.mark.plugin("vartaloop")): request body, validation, key redaction, in-order playback with stale leftovers dropped, retryable vs non-retryable errors.

make check (ruff format, ruff check, mypy strict) and the unit tests pass. No version bumps, per CONTRIBUTING.

Measured against the live API (2026-11-08, Mac to Mumbai, warm cache, 8 interleaved iterations)

path TTFA p50 ms (1 sentence) TTFA p50 ms (3 sentences) plugin − raw
raw WebSocket 40.8 40.5
plugin stream() 44.3 45.5 +3.2 / +4.9
raw REST 42.2 46.1
plugin synthesize() 44.4 46.9 +2.1 / +1.5

16 concurrent streams for 20 s: 28.4 audio-seconds per wall-second through the plugin vs 28.0 raw, TTFA p95 116 ms vs 103 ms. Full tables in the plugin's development repo (bench/RESULTS*.md).

🤖 Generated with Claude Code

roshanpuru and others added 5 commits November 7, 2026 22:23
Vartalaap is a Hinglish and Indian-language TTS API. The plugin synthesises over POST /v1/tts
(ChunkedStream, the chunked PCM body forwarded as it arrives) and streams over a pooled
WS /v1/tts/stream (SynthesizeStream): text is cut into sentences as the LLM produces it, every
sentence is sent as its own utterance and the server serves them in order, so the next sentence
is synthesised while the current one plays. Every server parameter (voice, expression, digits,
speed, temperature, seed, postfx, profile, raw) is a constructor option and an update_options
keyword; prewarm() opens the socket ahead of the first turn; handshake errors never carry the key.

Unit tests cover the request body, option validation, key redaction, in-order playback with
stale pooled-socket leftovers dropped, and retryable vs non-retryable server errors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ence

An error event tagged with another utterance's request_id (a pooled-socket leftover) no
longer fails the current stream; untagged errors still do. SynthesizeStream reads the
owning TTS's options when it sends each sentence, so update_options() between two
sentences applies to the next one on the same socket.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… before applying, expire sockets by lifetime

- the receive loop wakes when the sender finishes with nothing pending, instead of waiting
  for a server message that never comes (a turn whose last sentence ended before the LLM
  closed the input would otherwise hit the receive timeout)
- update_options validates a copy and assigns it only on success
- pooled sockets expire 5 min after they were opened, not 5 min after their last reuse

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With no utterance in flight the pause between sentences is the LLM's, not the server's, so
the stream waits for the next sentence or the end of input without a deadline; the
connection timeout applies only while the server owes a message.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The product is Vartaloop TTS: package livekit-plugins-vartaloop, module livekit.plugins.vartaloop,
env var VARTALOOP_API_KEY (VARTALAAP_API_KEY still read as a fallback), docs at docs.vartaloop.ai.
API host, model (narad) and behaviour unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…imeout

The untimed wait used while nothing is pending is woken by the next send and restarted with
the connection timeout, so a server that never answers a later sentence fails the stream at
the configured deadline instead of hanging until the input closes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@roshanpuru

Copy link
Copy Markdown
Author

Hi @tinalenguyen, whenever you have a moment, this one is ready for review: a streaming TTS plugin for Vartaloop (Hinglish and Indian-language voices). It is on 1.8.11, conflict-free, CI is green, and the Devin findings are resolved. Plugin overhead against the raw API is under 5 ms of time to first audio (benchmark in the description). The Node counterpart is livekit/agents-js#2958. Happy to turn around any feedback the same day, and to link the LiveKit docs page once it exists.

… its utterance

The server reports an error frame for the failed utterance and keeps the session
open, so dropping the socket made every retry pay a new handshake. The socket now
goes back to the pool when nothing else is in flight; with other utterances still
answering on it, it is dropped as before. README links the LiveKit docs page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devin-ai-integration[bot]

This comment was marked as resolved.

… reusable

A sentence sent between the error and the cleanup is still owed an answer on
the socket, so it is dropped in that case instead of going back to the pool.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@roshanpuru

Copy link
Copy Markdown
Author

Pushed two small follow-ups: the pooled WebSocket is now kept after a server error that ended only its utterance (the server keeps the session open, so a retry no longer pays a new handshake; the socket is still dropped when another sentence was already sent on it), and the README links the LiveKit docs page. Tests cover both cases; checks are green. The same change is on livekit/agents-js#2958.

roshanpuru and others added 3 commits November 10, 2026 10:49
…the socket

Only an error tagged with our utterance leaves the session usable.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Resolves the uv.lock conflict: took main's lock and re-ran uv lock so the
livekit-plugins-vartaloop entry is regenerated. The two pyproject registrations
merged cleanly. Plugin tests: 16 passed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
main released 1.8.12 and bumped every plugin extra, which conflicted with the
vartaloop extra in livekit-agents/pyproject.toml and with uv.lock. Took main's
files, re-added the extra at >=1.8.12, bumped the plugin version and its
livekit-agents floor to 1.8.12 to match, and re-ran uv lock. Plugin tests:
16 passed; ruff clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roshanpuru

Copy link
Copy Markdown
Author

Hi @tinalenguyen, a gentle follow-up on this one. It is up to date with main and on 1.8.12, conflict-free, and all checks are green; the Devin findings are resolved. Happy to make any changes you'd like, or to split it up if that is easier to review. The Node counterpart is livekit/agents-js#2958. Thank you!

roshanpuru and others added 2 commits November 16, 2026 20:20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@roshanpuru

Copy link
Copy Markdown
Author

Hi @tinalenguyen @chenghao-mou, could one of you take a look when you have a moment? The Vartaloop TTS plugin (Hinglish and Indian-English voices) is up to date with main, on the latest release, conflict-free and green, and every Devin finding is resolved. It has a companion PR for Python/Node (#8449 / livekit/agents-js#2958). Happy to make any changes quickly, and we'll be submitting the plugin partner form as well.

@roshanpuru

Copy link
Copy Markdown
Author

Quick update: we have now submitted the LiveKit Plugin Partner Submission form for Vartaloop (Python and Node.js, this PR and its companion #8449 / livekit/agents-js#2958), including the package transfer and maintenance agreements and free test access for the LiveKit team. Happy to send the draft docs page and logo or anything else you need.

# Conflicts:
#	livekit-agents/pyproject.toml
@roshanpuru

Copy link
Copy Markdown
Author

To complete our Plugin Partner Submission: the form would not accept file uploads, so the draft docs page and logos are here: https://github.com/vartalaap-si/livekit-plugins-vartaloop/tree/main/livekit-submission

This branch is up to date with the latest release and all checks are green. Happy to change anything you need.

roshanpuru and others added 2 commits November 29, 2026 05:07
…t waits short

408 and 429 are now retried like in the other plugins (5xx still are, other 4xx still are not).
The three timing tests wait 0.05-0.1 s instead of up to 1 s; the suite runs in 0.5 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@tinalenguyen tinalenguyen 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.

hi @roshanpuru, thanks for opening this PR! could you fill out the form again - i didn't see the submission

@roshanpuru

Copy link
Copy Markdown
Author

Thanks @tinalenguyen! I've resubmitted the form just now, with the draft docs (tts.md) and logo attached this time. It covers this PR and livekit/agents-js#2958.

This branch has not been deployed

No deployments
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.

2 participants