Skip to content

feat: add ElevenLabs TTS provider#134

Merged
wyuc merged 4 commits intoTHU-MAIC:mainfrom
nkmohit:feat/elevenlabs-tts
Mar 22, 2026
Merged

feat: add ElevenLabs TTS provider#134
wyuc merged 4 commits intoTHU-MAIC:mainfrom
nkmohit:feat/elevenlabs-tts

Conversation

@nkmohit
Copy link
Contributor

@nkmohit nkmohit commented Mar 19, 2026

Summary

Adds ElevenLabs as a first-class TTS provider in the existing audio provider architecture. This gives users an additional high-quality English narration option, with provider-specific API handling, settings/UI integration, logo support, and a free-tier-safe fallback voice set for ElevenLabs accounts.

Related Issues

Closes #132

Changes

  • Added elevenlabs-tts to the TTS provider type union
  • Added ElevenLabs provider metadata to lib/audio/constants.ts
    • default base URL: https://api.elevenlabs.io/v1
    • supported formats: mp3, opus, pcm, wav, ulaw, alaw
    • provider-specific speed range: 0.7 to 1.2
  • Implemented generateElevenLabsTTS(...) in lib/audio/tts-providers.ts
    • uses ElevenLabs xi-api-key auth
    • calls /v1/text-to-speech/{voice_id}
    • supports provider-specific output format mapping
  • Added a curated free-tier-safe fallback voice set for ElevenLabs
    • 3 female, 3 male, 1 neutral
    • based on account-visible premade/default-style voices rather than library voices that fail on free tier
  • Added ElevenLabs provider labels in settings i18n
  • Added settings/store integration for ElevenLabs TTS provider config
  • Added ElevenLabs logo asset in public/logos/elevenlabs.svg
  • Added ElevenLabs request URL preview in TTS settings using the same simplified pattern as other providers

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Bug fix (non-breaking change that fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or build changes

Verification

Steps to reproduce / test

  1. Open Settings → TTS
  2. Select ElevenLabs TTS
  3. Enter a valid ElevenLabs API key
  4. Confirm the request URL preview shows:
    • https://api.elevenlabs.io/v1/text-to-speech
  5. Run Test TTS
  6. Confirm preview audio is generated successfully

What you personally verified

  • Verified the provider is wired into the TTS registry, settings UI, i18n, and default settings store config
  • Queried ElevenLabs voice inventory and switched to a safer free-tier fallback set based on account-visible premade/default-style voices
  • Successfully got the ElevenLabs provider working locally after correcting provider configuration and voice selection

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally
  • Screenshots / recordings attached (if UI changes)

Screenshots:
Screenshot 2026-03-19 at 9 47 32 PM
Screenshot 2026-03-19 at 9 48 01 PM
Screenshot 2026-03-19 at 9 48 16 PM

Logs of successful elevenlabs tts api call:
Screenshot 2026-03-19 at 9 53 01 PM

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • My changes do not introduce new warnings

Copy link
Contributor

@wyuc wyuc left a comment

Choose a reason for hiding this comment

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

Reviewed, no issues found.

@wyuc wyuc merged commit 3a3e27b into THU-MAIC:main Mar 22, 2026
1 check passed
@nkmohit nkmohit deleted the feat/elevenlabs-tts branch March 22, 2026 16:27
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.

[Feature]: Add ElevenLabs TTS provider

2 participants