Skip to content

feat: add VoiceStudio as local ElevenLabs-compatible TTS provider - #982

Open
subrotosanyal wants to merge 5 commits into
OpenMontageInc:mainfrom
subrotosanyal:feat/voicestudio-tts
Open

subrotosanyal wants to merge 5 commits into
OpenMontageInc:mainfrom
subrotosanyal:feat/voicestudio-tts

Conversation

@subrotosanyal

@subrotosanyal subrotosanyal commented Nov 26, 2026 •

Copy link
Copy Markdown

Closes #983

Summary

  • Adds tools/audio/voicestudio_tts.py — a BaseTool subclass integrating VoiceStudio as a fully-local, zero-cost ElevenLabs alternative
  • tts_selector.py auto-discovers it via capability = "tts" and @register_tool — no other files need changing
  • get_status() probes VoiceStudio's /.well-known/voicestudio-speech health endpoint, so the tool only activates on machines where VoiceStudio is actually running

with_timestamps — two-pass local approach

ElevenLabs supports a /with-timestamps endpoint that returns word-level alignment alongside the audio. VoiceStudio has no equivalent TTS endpoint, so this tool implements the same result via two fully local passes:

Pass 1 — TTS: POST /elevenlabs/v1/text-to-speech/{voice_id} → audio bytes

Pass 2 — STT: POST /elevenlabs/v1/speech-to-text → the generated audio is fed back to VoiceStudio's own speech-to-text endpoint, which returns word-level timestamps

The word timings are then assembled into the same .alignment.json sidecar and word_timestamps structure that elevenlabs_tts produces — caption sync and word-cued animation pipeline steps see no difference. No ElevenLabs API key is used at any point.

Trade-off: timestamps come from transcription rather than the synthesis model, so they may be a few milliseconds less precise than ElevenLabs' native alignment. In practice the difference is imperceptible for captions and subtitle sync.

How it works

VoiceStudio exposes an ElevenLabs-compatible API at http://127.0.0.1:3900/elevenlabs. This tool hits:

POST /v1/text-to-speech/{voice_id}?output_format=mp3_44100_128
POST /v1/speech-to-text   ← only when with_timestamps=true
xi-api-key: <OMNIVOICE_API_KEY>   # only needed for non-loopback

Supported output formats: mp3_44100_128, mp3_44100_192, pcm_16000, pcm_24000, pcm_44100, wav_44100.

Configuration

Env var Default Purpose
VOICESTUDIO_URL http://127.0.0.1:3900/elevenlabs Override base URL for remote instances
OMNIVOICE_API_KEY (none) API key for non-loopback auth

Comparison with elevenlabs_tts

Feature ElevenLabs (cloud) VoiceStudio (local)
Cost ~$0.0003/char $0.00
with_timestamps Native (single pass) Two-pass via local STT
Voice cloning ✓ ✓
Languages 29 646
Default voice Rachel (EL ID) "default"
Requires API key ✓ ✗ (loopback)
Offline ✗ ✓

Tests

File Type Runs in CI
tests/tools/test_voicestudio_tts.py Unit (25 cases, mocked HTTP) ✓
tests/tools/test_voicestudio_tts_integration.py Integration (live VoiceStudio) opt-in
tests/tools/test_voicestudio_elevenlabs_parity.py Cross-provider shape parity opt-in

Fallback chain

voicestudio_tts → openai_tts → piper_tts

Adds tools/audio/voicestudio_tts.py — a BaseTool subclass that integrates
VoiceStudio (https://github.com/debpalash/VoiceStudio) as a fully-local,
ElevenLabs-compatible TTS provider.

- capability = "tts" so tts_selector.py auto-discovers it
- get_status() probes VoiceStudio's health endpoint; only activates when
  VoiceStudio is running (safe on machines without it)
- Hits http://127.0.0.1:3900/elevenlabs/v1/text-to-speech/{voice_id}
- VOICESTUDIO_URL env var overrides base URL for remote instances
- OMNIVOICE_API_KEY env var for non-loopback auth
- cost_usd: 0.0 (local inference)
- Falls back to openai_tts → piper_tts

Note: VoiceStudio does not support with_timestamps (ElevenLabs word-level
alignment). A separate /v1/speech-to-text pass is needed for captions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
subrotosanyal and others added 4 commits November 26, 2026 10:12
Pass 1: POST /elevenlabs/v1/text-to-speech → audio
Pass 2: POST /elevenlabs/v1/speech-to-text → word timings

Assembles the same .alignment.json sidecar and word_timestamps structure
that elevenlabs_tts produces, so caption sync and word-cued animation
pipeline steps work without modification. No ElevenLabs API key used.

Also upgrades the tool to match elevenlabs_tts class structure more closely:
uses execute()/ToolResult, ResourceProfile, RetryPolicy, stability/execution_mode
fields, and proper capabilities/supports metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three test files covering unit (mocked), integration (live VoiceStudio),
and cross-provider parity (VoiceStudio vs ElevenLabs). Integration and
parity tests are skipped unless OPENMONTAGE_ALLOW_NETWORK=1 is set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three test files covering unit (mocked), integration (live VoiceStudio),
and cross-provider parity (VoiceStudio vs ElevenLabs). Integration and
parity tests are skipped unless OPENMONTAGE_ALLOW_NETWORK=1 is set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three test files covering unit (mocked), integration (live VoiceStudio),
and cross-provider parity (VoiceStudio vs ElevenLabs). Integration and
parity tests are skipped unless OPENMONTAGE_ALLOW_NETWORK=1 is set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

New TTS provider: VoiceStudio (local, zero-cost ElevenLabs alternative)

1 participant