how do you use Elevenlabs tts with the plugin usin...
# ask-ai
n
how do you use Elevenlabs tts with the plugin using the latest versions? Getting erros from elevenlabs even though everything is correct. Using agents-js
t
Thanks for reaching out, Francisco. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m happy to help get ElevenLabs TTS working with
agents-js
. I’ll walk through the expected setup and then ask a few targeted questions so I can troubleshoot the specific error you’re seeing. What I’m responding to: how to use the ElevenLabs TTS plugin with
agents-js
(Node) and why you might still be getting ElevenLabs errors. Quick checklist — what you must have in place • Install the ElevenLabs plugin package: ◦ pnpm add "@livekit/agents-plugin-elevenlabs@1.x" • Provide your ElevenLabs API key in env as
ELEVEN_API_KEY
so the plugin can authenticate. • Configure
AgentSession
to use the plugin, for example:
Copy code
import * as elevenlabs from '@livekit/agents-plugin-elevenlabs';

  const session = new voice.AgentSession({
    tts: new elevenlabs.TTS({
      voice: { id: "ODq5zmih8GrVes37Dizd" },
      model: "eleven_multilingual_v2"
    }),
    // other config...
  });
• Use compatible SDK versions (e.g.,
@livekit/agents
v1.0.7+ for Node). Common causes of ElevenLabs errors (and quick fixes) • Authentication error: confirm
ELEVEN_API_KEY
is set in the environment your Node process runs in and that the key is valid (not expired or revoked). • Rate limiting or permission errors: verify your ElevenLabs account hasn’t hit limits and that the key has correct permissions. • Wrong voice/model IDs: use a supported voice ID and supported model (e.g.,
eleven_multilingual_v2
); custom/cloned voices require using the ElevenLabs account via the plugin (not LiveKit Inference voice names). • Mixing plugin vs Inference syntax: don’t pass model descriptors like
"elevenlabs/..."
to LiveKit Inference when you’re using the plugin. Use the plugin’s
TTS
configuration instead. • Network / CORS / proxy issues: ensure your environment can reach ElevenLabs endpoints and that any proxy/firewall allows outbound calls. Next I need from you to diagnose the specific error Please share: 1. The exact error message or stack trace you’re seeing (copy/paste the full error). 2. A minimal reproduction snippet of how you instantiate the
AgentSession
/
TTS
(remove secrets). 3. Which versions you’re using: ◦
@livekit/agents
(agents-js) version ◦
@livekit/agents-plugin-elevenlabs
version ◦ Node.js version 1. Whether
ELEVEN_API_KEY
is set in your runtime environment and how you’re setting it (e.g.,
.env
, CI secret, system env). 2. Whether the failing call is during startup, when you call a TTS method, or at runtime while streaming. If you prefer, paste the error and the short code snippet and I’ll point out the likely cause and exact lines to change. Sources: ElevenLabs TTS plugin guide | LiveKit Documentation | Models overview | LiveKit Documentation | ElevenLabs TTS | LiveKit Documentation