Skip to content

Add Smallest AI TTS service integration#4092

Merged
markbackman merged 3 commits intopipecat-ai:mainfrom
harshitajain165:harshita/smallest-tts-only
Mar 24, 2026
Merged

Add Smallest AI TTS service integration#4092
markbackman merged 3 commits intopipecat-ai:mainfrom
harshitajain165:harshita/smallest-tts-only

Conversation

@harshitajain165
Copy link
Copy Markdown
Contributor

@harshitajain165 harshitajain165 commented Mar 20, 2026

Summary

Adds Smallest AI WebSocket-based TTS service, aligned with current Pipecat conventions.

This PR has the following history:

The TTS implementation is taken directly from #4014 with no changes. The only difference is:

  • stt.py removed — will be submitted as a follow-up PR once the STT issue is resolved
  • stt_latency.py unchanged — SMALLEST_TTFS_P99 will be added with the STT PR
  • Example (07zl-interruptible-smallest.py) uses DeepgramSTTService as a stand-in for STT

Everything else — settings pattern, keepalive, _update_settings overrides, model enum — is identical to #4014.

Key details

  • WebSocket-only: WebSocket service for real-time use
  • Settings pattern: SmallestTTSSettings dataclass with runtime-updatable fields
  • Init-only vs runtime-updatable: model is init-only; voice/language/speed/etc. are runtime-updatable
  • _update_settings override: TTS reconnects only on model change
  • TTS keepalive: Flush keepalive every 30s to prevent 60s idle timeout
  • TTS settings default to None: API applies its own defaults for speed/consistency/similarity/enhancement
  • Model enum: SmallestTTSModel.LIGHTNING_V3_1

Adds SmallestTTSService, a WebSocket-based TTS service using Smallest AI's
Lightning v3.1 model. Follows current Pipecat service conventions:

- SmallestTTSSettings dataclass with runtime-updatable settings (voice,
  language, speed, etc.)
- Reconnects on model change; keepalive every 30s to prevent idle timeout
- TTS settings default to None so the API applies its own defaults
- Model enum: SmallestTTSModel.LIGHTNING_V3_1

Includes a foundational example (07zl-interruptible-smallest.py) using
Deepgram STT + Smallest TTS + OpenAI LLM.

STT integration will follow in a separate PR once the hallucination/finalize
behaviour is resolved.

Made-with: Cursor
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 34.52381% with 110 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/services/smallest/tts.py 34.52% 110 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/services/smallest/tts.py 34.52% <34.52%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ystem

- Route audio through audio contexts (append_to_audio_context) instead of
  pushing frames directly, enabling proper turn management and interruptions
- Add push_stop_frames and push_start_frame so the base class handles
  TTSStartedFrame/TTSStoppedFrame lifecycle
- Remove manual context_id tracking (self._context_id) in favor of
  get_active_audio_context_id()
- Don't call remove_audio_context on "complete" — Smallest sends one
  per request, not per turn; let the base class timeout handle cleanup
- Guard v2-only params (consistency, similarity, enhancement) so they
  aren't sent to lightning-v3.1
- Remove request_id from request payload (not a documented request field)
- Add flush_audio override to send flush to WebSocket
@markbackman markbackman force-pushed the harshita/smallest-tts-only branch from c2106f5 to f68b322 Compare March 24, 2026 15:47
Copy link
Copy Markdown
Contributor

@markbackman markbackman left a comment

Choose a reason for hiding this comment

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

LGTM! I pushed a few additional changes to this branch to align with some TTS service changes we've made. Everything looks good now. Thanks for the help on this one 🙌

@markbackman markbackman merged commit 6eb988b into pipecat-ai:main Mar 24, 2026
10 checks passed
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