Im getting error when trying to use elevenlabs mod...
# ask-ai
a
Im getting error when trying to use elevenlabs model: eleven_v3
Copy code
failed to synthesize speech, retrying in 0.1s                             {"tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 1, "streamed":  
                                     Traceback (most recent call last):                                        true, "pid": 47985, "job_id": "AJ_syYiiWwSkEFk", "room_id":              
                                       File                                                                    "RM_aQPELdpBvEoF"}                                                       
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/livekit/plugins/elevenlabs/tts.py", line 369, in _run                                                                                      
                                         connection = await asyncio.wait_for(                                                                                                           
                                                      ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                           
                                             self._tts.current_connection(), self._conn_options.timeout                                                                                 
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                 
                                         )                                                                                                                                              
                                         ^                                                                                                                                              
                                       File                                                                                                                                             
                                     "/opt/homebrew/Cellar/python@3.13/3.13.3_1/Frameworks/Python.framework/Ve                                                                          
                                     rsions/3.13/lib/python3.13/asyncio/tasks.py", line 507, in wait_for                                                                                
                                         return await fut                                                                                                                               
                                                ^^^^^^^^^                                                                                                                               
                                       File                                                                                                                                             
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/livekit/plugins/elevenlabs/tts.py", line 250, in                                                                                           
                                     current_connection                                                                                                                                 
                                         await conn.connect()                                                                                                                           
                                       File                                                                                                                                             
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/livekit/plugins/elevenlabs/tts.py", line 525, in connect                                                                                   
                                         self.ws = await self.session.ws_connect(url, headers=headers)                                                                                
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                
                                       File                                                                                                                                             
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/aiohttp/client.py", line 1021, in _ws_connect                                                                                              
                                         raise WSServerHandshakeError(                                                                                                                  
                                         ...<5 lines>...                                                                                                                                
                                         )                                                                                                                                              
                                     aiohttp.client_exceptions.WSServerHandshakeError: 403, message='Invalid                                                                            
                                     response status',                                                                                                                                  
                                     url='wss://api.elevenlabs.io/v1/text-to-speech/7tappATJmL26KbHEb0R1/multi                                                                          
                                     -stream-input?model_id=eleven_v3&output_format=mp3_22050_32&language_code                                                                          
                                     =da&enable_ssml_parsing=false&enable_logging=true&inactivity_timeout=180&                                                                          
                                     apply_text_normalization=auto&sync_alignment=true&auto_mode=true'                                                                                  
                                                                                                                                                                                        
                                     The above exception was the direct cause of the following exception:                                                                               
                                                                                                                                                                                        
                                     Traceback (most recent call last):                                                                                                                 
                                       File                                                                                                                                             
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/livekit/agents/tts/tts.py", line 383, in _main_task                                                                                        
                                         await self._run(output_emitter)                                                                                                                
                                       File                                                                                                                                             
                                     "/Users/malteholledig/Freja/freja-agent-python/venv/lib/python3.13/site-p                                                                          
                                     ackages/livekit/plugins/elevenlabs/tts.py", line 375, in _run                                                                                      
                                         raise APIConnectionError("could not connect to ElevenLabs") from e                                                                             
                                     livekit.agents._exceptions.APIConnectionError: could not connect to                                                                                
                                     ElevenLabs (body=None, retryable=True)
Code
Copy code
tts=elevenlabs.TTS(
                model=tts_model,
                voice_id=voice_id,
                voice_settings=settings,
                language=language,
            ),
Do I need some other setting when using the v3 model? It works fine when using
eleven_turbo_v2_5
t
Thanks for reaching out, Malte. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I looked at the error and your code. You're hitting a 403 because the v3 multimodal model requires the plugin to call ElevenLabs' different endpoint. You need to explicitly set
model_id="eleven_v3"
(or include it in the model string) so the plugin uses the correct route. What to try:
Copy code
tts = elevenlabs.TTS(
    model="eleven_v3",
    model_id="eleven_v3",    # required for v3
    voice_id=voice_id,
    voice_settings=settings,
    language=language,
)
Notes: • Ensure the
voice_id
you use is compatible with
eleven_v3
. • If you still get 403 after adding
model_id
, tell me the exact
voice_id
and language you’re using and I’ll help check compatibility and headers. Would you like that? Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Text-to-speech (TTS) models | LiveKit Docs
a
There is no model_id param
t
Thanks — you're right that
model_id
isn't a param. I'm responding to your note that there is no
model_id
and you still get a 403 with
eleven_v3
. Quick summary and next steps you can try: • Use the
model
parameter (not
model_id
). Confirm the exact string you set for
model
(e.g.,
"eleven_v3"
or
"eleven_turbo_v2_5"
). • Confirm your
ELEVEN_API_KEY
is set where the process can read it (local .env vs. environment). A 403 often means the key or permissions are invalid for the requested model/endpoint. • Verify the model name is supported by the plugin. Current supported model names include
eleven_multilingual_v2
,
eleven_turbo_v2_5
, etc.
eleven_v3
may not be a supported model name for the plugin. To help debug, please provide: • The exact
model
string you passed. • The minimal reproducible code snippet you use to construct the TTS object. • The
voice_id
value (just the ID). • How you supply the ElevenLabs API key (ENV var name/location). • Versions of LiveKit Agents and the ElevenLabs plugin you’re using (package names + versions). • OS and Python version (optional). Send those and I’ll pinpoint whether this is a config mismatch, API-key/permission issue, or a plugin incompatibility and give the exact fix. Sources: ElevenLabs TTS plugin guide | LiveKit Docs | ElevenLabs TTS | LiveKit Docs