such as ElevenLabs requires a voice and paid plan ...
# ask-ai
e
such as ElevenLabs requires a voice and paid plan how to connect api key from ElevenLabs to LiveKit
✅ 1
t
Thanks for reaching out, Dmitry. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I understand you want to connect an ElevenLabs API key (ElevenLabs requires a paid voice plan for custom voices) to LiveKit. Below are the two ways you can use ElevenLabs with LiveKit and the steps to configure the direct ElevenLabs plugin if you need custom/paid voices. Acknowledgement • You’re asking how to connect an ElevenLabs API key to LiveKit so you can use ElevenLabs voices (including paid/custom voices). Options (brief) • LiveKit Inference (recommended if you don’t need custom/community voices) ◦ You do not need to provide an ElevenLabs API key. ◦ This route gives access to ElevenLabs TTS via LiveKit’s unified API but only supports default voices (custom voices are not supported). • Direct ElevenLabs plugin (use this if you need custom or paid ElevenLabs features) ◦ You must supply your own ElevenLabs API key and this lets you use custom voices, voice cloning, and advanced voice settings. How to connect the ElevenLabs API key (Direct plugin) 1. Install the ElevenLabs plugin for LiveKit agents: ◦ Run:
Copy code
uv add "livekit-agents[elevenlabs]~=1.4"
1. Set your ElevenLabs API key in your environment: ◦ Add to your
.env
file:
Copy code
ELEVEN_API_KEY=your_elevenlabs_api_key
1. Configure the plugin in your agent code: ◦ Example usage:
Copy code
from livekit.plugins import elevenlabs

     session = AgentSession(
         tts=elevenlabs.TTS(
             voice_id="ODq5zmih8GrVes37Dizd",
             model="eleven_multilingual_v2"
         )
         # ... llm, stt, etc.
     )
• Pick a model such as
eleven_flash_v2_5
,
eleven_multilingual_v2
, or
eleven_turbo_v2
. • Use
voice_id
for the specific custom voice you want to use. • Optional: set
voice_settings
(stability, similarity_boost, style, speed),
language
,
enable_ssml_parsing
, and
chunk_length_schedule
as needed. Notes and tips • Custom/community voices require a paid ElevenLabs plan; ensure your ElevenLabs account and API key have access to the voice(s) you intend to use. • If you only need basic/default voices and want to avoid managing your own ElevenLabs key, use LiveKit Inference. • If you plan to stream audio with low latency, you can tune streaming latency and chunking settings in the plugin. If you want, tell me: • Which route you prefer (LiveKit Inference or Direct plugin), and • The language/model/voice_id you intend to use (or whether you need help finding the voice_id), and I’ll give the exact code snippet or walk through any errors you run into. Sources: ElevenLabs TTS | LiveKit Documentation, with interactive elements
e
how to setup ElevenLabs key in web LiveKit experience website
t
Thanks — I understand you want to set up an ElevenLabs API key so ElevenLabs voices work in a web LiveKit experience. Below I’ll show the two approaches and the exact steps for the common web setup (frontend + backend), since the ElevenLabs key must be kept on the server and not exposed to the browser. Quick choices (pick one) • LiveKit Inference: No ElevenLabs key required in your project. Use this if you only need default voices and want LiveKit to handle TTS billing/auth. • Direct ElevenLabs plugin: Use your own ElevenLabs API key to access custom/paid voices. This requires configuring the key on your backend (not in browser). If you want custom/paid ElevenLabs voices for a web experience, follow these steps. 1) Backend: store the ElevenLabs API key (never in frontend) • Add your key to your backend environment (example .env):
Copy code
ELEVEN_API_KEY=your_elevenlabs_api_key
• The ElevenLabs plugin reads this environment variable when running your agent or server. 2) Install and configure the ElevenLabs plugin in your agent/service • Install the plugin for your environment (example for LiveKit agents):
Copy code
uv add "livekit-agents[elevenlabs]~=1.4"
• In your backend agent/server code, configure TTS using the ElevenLabs plugin. Example (Python-style snippet):
Copy code
from livekit.plugins import elevenlabs

  session = AgentSession(
      tts=elevenlabs.TTS(
          voice_id="ODq5zmih8GrVes37Dizd",
          model="eleven_multilingual_v2"
      )
      # ... llm, stt, etc.
  )
• Choose an appropriate model (
eleven_flash_v2_5
,
eleven_multilingual_v2
,
eleven_turbo_v2
) and the
voice_id
for the custom voice you want. Optional settings:
voice_settings
,
enable_ssml_parsing
,
chunk_length_schedule
, and streaming latency. 3) Frontend (web LiveKit experience) • The browser app should never contain the ElevenLabs API key. • Frontend connects to LiveKit / your agent backend using tokens generated by your backend. Typical flow: a. User opens web app and requests to join a room or use a voice agent. b. Frontend calls your backend endpoint to request a LiveKit token / agent session. c. Backend (which has
ELEVEN_API_KEY
) creates/returns a token and triggers the agent that will call ElevenLabs for TTS. d. Frontend uses the token to connect to LiveKit and receives audio streams produced by the backend/agent. 4) If you prefer no-server setup for simple/default voices • Use LiveKit Inference from the LiveKit web Agent Builder or Inference integrations. No ElevenLabs key is required; LiveKit handles access and billing, but custom/community voices are not supported. What I can help with next • Show the exact backend code snippet for your stack (Node or Python) to read
ELEVEN_API_KEY
, initialize the plugin, and produce TTS. • Walk through the token endpoint pattern your frontend should call to obtain a LiveKit token / start an agent session. • Help pick a model/voice_id or show how to test audio output. Which would you like me to show next: a Node.js or Python backend example for wiring the ElevenLabs plugin and the LiveKit token endpoint? Sources: ElevenLabs TTS | LiveKit Documentation | ElevenLabs STT | LiveKit Documentation | TTS Translator with Gladia STT | LiveKit Documentation | Web and mobile frontends | LiveKit Documentation | Examples | livekit/livekit_composite | DeepWiki, with interactive elements