i am trying to connect a agent using elevenlabs tt...
# ask-ai
l
i am trying to connect a agent using elevenlabs tts, this is my tts config, tts=elevenlabs.TTS( api_key=os.getenv("ELEVEN_API_KEY"), voice_id="G1qujbcurbblbamyltgl", model="eleven_turbo_v2_5", language="ar", enable_ssml_parsing=False, apply_text_normalization="auto", enable_logging=True, ), but as soon as i try to connect this error comes up WARNINGlivekit.plugins.elevenlabswebsocket closed unexpectedly {"level": "WARNING", "name": "livekit.plugins.elevenlabs", "message": "websocket closed unexpectedly", "timestamp": "2025-11-26T133439.362663+00:00"} WARNINGlivekit.agentsfailed to synthesize speech, retrying in 0.1s Traceback (most recent call last): File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\livekit\agents\tts\tts.py", line 396, in _main_task await self._run(output_emitter) File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\livekit\plugins\elevenlabs\tts.py", line 440, in _run raise e File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\livekit\plugins\elevenlabs\tts.py", line 435, in _run await waiter livekit.agents._exceptions.APIStatusError: connection closed (status_code=-1, request_id=None, body=None, retryable=True) {"level": "WARNING", "name": "livekit.agents", "message": "failed to synthesize speech, retrying in 0.1s", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\livekit\\agents\\tts\\tts.py\", line 396, in _main_task\n await self._run(output_emitter)\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\livekit\\plugins\\elevenlabs\\tts.py\", line 440, in _run\n raise e\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\livekit\\plugins\\elevenlabs\\tts.py\", line 435, in _run\n await waiter\nlivekit.agents._exceptions.APIStatusError: connection closed (status_code=-1, request_id=None, body=None, retryable=True)", "tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 1, "streamed": true, "timestamp": "2025-11-26T133439.371722+00:00"} WARNINGlivekit.plugins.elevenlabswebsocket closed unexpectedly {"level": "WARNING", "name": "livekit.plugins.elevenlabs", "message": "websocket closed unexpectedly", "timestamp": "2025-11-26T133440.640110+00:00"} WARNINGlivekit.agentsfailed to synthesize speech, retrying in 2.0s how to fix this error??
t
Thanks for reaching out, Computer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I see you're hitting repeated "websocket closed unexpectedly" errors when the agent tries to synthesize speech with ElevenLabs TTS. I'll help you troubleshoot the most likely causes and next steps. Please try these checks and changes in this order: 1. Fix parameter name • Change
model="eleven_turbo_v2_5"
to
model_id="eleven_turbo_v2_5"
. The plugin expects `model_id`; using
model
can cause initialization failures that look like a closed WebSocket. 1. Verify your API key • Ensure
ELEVEN_API_KEY
is set, correct, and accessible to your process (print or log a masked value to confirm it's being loaded). 1. Confirm the voice supports Arabic • The voice ID you provided may not support
language="ar"
. Test with a known Arabic-capable voice or temporarily remove
language
to see if the connection succeeds. 1. Test connectivity to ElevenLabs • From the same machine run a quick network test: ◦ curl -v https://api.elevenlabs.io ◦ Confirm no firewall/proxy is blocking outbound TLS to api.elevenlabs.io 1. Turn up logging and capture the ElevenLabs plugin logs • Keep
enable_logging=True
. Capture the full debug logs around the WebSocket open/close to see whether the server sends a close frame or the client closes. 1. Update the plugin • Run: pip install --upgrade livekit-plugins-elevenlabs to ensure you have the latest WebSocket handling fixes. 1. Add retry/fallback (optional) • If intermittent network or voice incompatibility is suspected, wrap ElevenLabs in a
FallbackAdapter
with a secondary TTS to avoid repeated failures during testing. If you try the
model_id
fix and the connectivity/voice checks and still see the same error, please share: • The exact
livekit-plugins-elevenlabs
version (pip show livekit-plugins-elevenlabs) • The trimmed debug log lines immediately before the "websocket closed unexpectedly" message • Whether you’re behind a proxy or corporate firewall I’ll use that to guide the next step. Would you like instructions for checking the plugin version and collecting the debug logs? Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Events and error handling | LiveKit docs
l
C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent>curl -v https://api.elevenlabs.io * Host api.elevenlabs.io:443 was resolved. * IPv6: (none) * IPv4: 34.8.184.191 * Trying 34.8.184.191:443... * schannel: disabled automatic use of client certificate * ALPN: curl offers http/1.1 * ALPN: server accepted http/1.1 * Connected to api.elevenlabs.io (34.8.184.191) port 443 * using HTTP/1.x
GET / HTTP/1.1
Host: api.elevenlabs.io
User-Agent: curl/8.13.0
Accept: /
* Request completely sent off < HTTP/1.1 404 Not Found < date: Wed, 26 Nov 2025 133908 GMT < server: uvicorn < Content-Length: 22 < content-type: application/json < access-control-allow-origin: * < access-control-allow-headers: * < access-control-allow-methods: POST, PATCH, OPTIONS, DELETE, GET, PUT < access-control-max-age: 600 < strict-transport-security: max-age=31536000; includeSubDomains < x-trace-id: c2274c4616c6ed7f06b6acb6369de28b < x-region: us-central1 < Via: 1.1 google, 1.1 google < Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 < {"detail":"Not Found"}* Connection #0 to host api.elevenlabs.io left intact
t
Thanks — I see your curl reached api.elevenlabs.io and returned 404, which confirms network connectivity to ElevenLabs is fine. I'll guide the next targeted checks. Please do these three quick steps and share the results: 1) Verify
model_id
change • Confirm your TTS config now uses
model_id="eleven_turbo_v2_5"
(not
model
). Paste the exact TTS snippet if you want me to check. 2) Test the ElevenLabs synth endpoint with your API key • Run this (replace <KEY> and a voice id you have) and paste the response: curl -s -o /dev/null -w "%{http_code}\n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" \ -H "xi-api-key: <KEY>" \ -H "Content-Type: application/json" \ -d "{\"text\":\"مرحبا\"}" • Expected: 200 or 201 (not 401/403). If you get 401/403, the key is invalid or missing scopes. 3) Share plugin version and trimmed debug lines • Run: pip show livekit-plugins-elevenlabs Paste the Version value. • From your agent logs, copy 8–12 lines immediately before the "websocket closed unexpectedly" warning (include any stack frames from the elevenlabs plugin). What I’ll do once you share those: confirm the config, verify the API key/endpoint response, check for known version bugs, and point to the exact next fix (voice compatibility, auth, or plugin update).
t
I ran a similar issue. Will suggest checking the monthly token limit of the api key. Mine was resolved after increasing it
l
ERRORlivekit.agentsunhandled exception while running the job task Traceback (most recent call last): File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\opentelemetry\util\_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 284, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\agent.py", line 144, in entrypoint await session.start(agent=KuwaitiAgent(azure_client), room=ctx.room) ~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\agent.py", line 72, in init tts=elevenlabs.TTS( ~~~~~~~~~~~~~~^ api_key=os.getenv("ELEVEN_API_KEY"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... enable_logging=True, ^^^^^^^^^^^^^^^^^^^^ ), ^ TypeError: TTS.__init__() got an unexpected keyword argument 'model_id' {"level": "ERROR", "name": "livekit.agents", "message": "unhandled exception while running the job task", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\opentelemetry\\util\\_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\livekit\\agents\\ipc\\job_proc_lazy_main.py\", line 284, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\agent.py\", line 144, in entrypoint\n await session.start(agent=KuwaitiAgent(azure_client), room=ctx.room)\n ~~~~~~~~~~~~^^^^^^^^^^^^^^\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\agent.py\", line 72, in __init__\n tts=elevenlabs.TTS(\n ~~~~~~~~~~~~~~^\n api_key=os.getenv(\"ELEVEN_API_KEY\"),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<5 lines>...\n enable_logging=True,\n ^^^^^^^^^^^^^^^^^^^^\n ),\n ^\nTypeError: TTS.__init__() got an unexpected keyword argument 'model_id'", "timestamp": "2025-11-26T134130.489507+00:00"}
t
Thanks — I see the new error:
TypeError: TTS.__init__() got an unexpected keyword argument 'model_id'
. That means the version of the ElevenLabs TTS plugin you're using does not accept
model_id
. Two ways to proceed: Options • Keep your current plugin version: revert to the original parameter name
model="eleven_turbo_v2_5"
in your TTS constructor. • Upgrade the plugin: install a version that supports
model_id
and keep
model_id="eleven_turbo_v2_5"
. Please run these two commands and paste the outputs so I can recommend the best next step: 1) pip show livekit-plugins-elevenlabs 2) pip list | grep livekit If you prefer to try one quick change now, either: • Revert to:
Copy code
tts=elevenlabs.TTS(
    api_key=os.getenv("ELEVEN_API_KEY"),
    voice_id="G1qujbcurbblbamyltgl",
    model="eleven_turbo_v2_5",
    language="ar",
    enable_ssml_parsing=False,
    apply_text_normalization="auto",
    enable_logging=True,
)
or • Upgrade and then use `model_id`:
Copy code
pip install --upgrade livekit-plugins-elevenlabs
Also keep in mind the monthly token/quota point you mentioned — if the API key quota is exhausted the WebSocket can close. After you share the plugin version outputs, I’ll confirm which change is best and next troubleshooting steps (voice compatibility, quota check, or full debug log parsing).
l
(.venv) C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent>python -m pip show livekit-plugins-elevenlabs Name: livekit-plugins-elevenlabs Version: 1.3.5 Summary: Agent Framework plugin for voice synthesis with ElevenLabs' API. Home-page: Author: Author-email: LiveKit <hello@livekit.io> License-Expression: Apache-2.0 Location: C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages Requires: livekit-agents Required-by: (.venv) C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent>python -m pip list | grep livekit 'grep' is not recognized as an internal or external command, operable program or batch file.
t
Thanks — I reviewed your environment and logs. You’re on livekit-plugins-elevenlabs v1.3.5, and that explains the TypeError: this version’s TTS constructor does not accept
model_id
,
voice_id
, or
language
. Use the parameter names this plugin expects. Please update your TTS config to this form (matches v1.3.5):
Copy code
tts = elevenlabs.TTS(
    api_key=os.getenv("ELEVEN_API_KEY"),
    voice="G1qujbcurbblbamyltgl",
    model_id="eleven_turbo_v2_5",
    language_code="ar",
    enable_ssml_parsing=False,
    apply_text_normalization="auto",
    enable_logging=True,
)
Next steps to resolve the WebSocket closures: • Confirm the API key quota: verify the ElevenLabs key monthly/request limits and usage; exhausted quota will close connections. Increase quota or use a key with sufficient allowance. • Test direct synth call with your key and voice (replace <KEY>): curl -s -o /dev/null -w "%{http_code}\n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" -H "xi-api-key: <KEY>" -H "Content-Type: application/json" -d "{\"text\":\"مرحبا\"}" Expected 200/201. 401/403 = auth issue; 429 = quota limit. • Ensure the voice supports Arabic. If the voice doesn’t support
ar
, switch to a confirmed Arabic-capable voice for testing. • Keep
enable_logging=True
and capture the debug log lines immediately before the "websocket closed unexpectedly" message if the problem persists. If you’d like, paste the curl HTTP status you get from the synth test and the 8–12 log lines before the websocket warning; I’ll help interpret them and recommend the exact next action. Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Models | LiveKit Docs
l
INFOlivekit.agentsjob runner initialized {"level": "INFO", "name": "livekit.agents", "message": "job runner initialized", "tid": 20092, "elapsed_time": 0.0, "timestamp": "2025-11-26T134826.509741+00:00"} INFO main 🚀 Starting Kuwaiti ElevenLabs Agent {"level": "INFO", "name": "__main__", "message": "🚀 Starting Kuwaiti ElevenLabs Agent", "timestamp": "2025-11-26T134826.584215+00:00"} ERRORlivekit.agentsunhandled exception while running the job task Traceback (most recent call last): File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\opentelemetry\util\_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\.venv\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 284, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\agent.py", line 144, in entrypoint await session.start(agent=KuwaitiAgent(azure_client), room=ctx.room) ~~~~~~~~~~~~^^^^^^^^^^^^^^ File "C:\Users\AaronFrancis\Desktop\my work\vscode\research\arabic agent\agent.py", line 72, in init tts=elevenlabs.TTS( ~~~~~~~~~~~~~~^ api_key=os.getenv("ELEVEN_API_KEY"), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... enable_logging=True, ^^^^^^^^^^^^^^^^^^^^ ), ^ TypeError: TTS.__init__() got an unexpected keyword argument 'voice' {"level": "ERROR", "name": "livekit.agents", "message": "unhandled exception while running the job task", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\opentelemetry\\util\\_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\.venv\\Lib\\site-packages\\livekit\\agents\\ipc\\job_proc_lazy_main.py\", line 284, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\agent.py\", line 144, in entrypoint\n await session.start(agent=KuwaitiAgent(azure_client), room=ctx.room)\n ~~~~~~~~~~~~^^^^^^^^^^^^^^\n File \"C:\\Users\\AaronFrancis\\Desktop\\my work\\vscode\\research\\arabic agent\\agent.py\", line 72, in __init__\n tts=elevenlabs.TTS(\n ~~~~~~~~~~~~~~^\n api_key=os.getenv(\"ELEVEN_API_KEY\"),\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n ...<5 lines>...\n enable_logging=True,\n ^^^^^^^^^^^^^^^^^^^^\n ),\n ^\nTypeError: TTS.__init__() got an unexpected keyword argument 'voice'", "timestamp": "2025-11-26T134828.643514+00:00"} also when i created the key i set unlimited for elevenlabs
t
Thanks — I see the latest error (
TTS.__init__() got an unexpected keyword argument 'voice'
) and that you set the ElevenLabs key to unlimited. You're on livekit-plugins-elevenlabs 1.3.5, so use the parameters that version expects. Please update your TTS config to this exact form:
Copy code
tts = elevenlabs.TTS(
    api_key=os.getenv("ELEVEN_API_KEY"),
    voice_id="G1qujbcurbblbamyltgl",
    model="eleven_multilingual_v2",
    language="ar",
    enable_ssml_parsing=False,
    apply_text_normalization="auto",
)
Notes and next checks: • Use
voice_id
,
model
, and
language
(these match v1.3.5). Do not pass
voice
,
model_id
, or
enable_logging
— those cause the TypeError. • Use
model="eleven_multilingual_v2"
for Arabic; other models may not support
ar
. • Even with "unlimited" set, confirm the key returns 200/201 when testing the synth endpoint (this rules out quota/auth issues): curl -s -o /dev/null -w "%{http_code}\n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" \ -H "xi-api-key: <KEY>" \ -H "Content-Type: application/json" \ -d '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}' • Expected: 200/201. If you get 401/403 -> key/auth problem; 429 -> quota/rate-limit. If that config still yields "websocket closed unexpectedly," paste: • The HTTP status from the curl test above • 8–12 log lines immediately before the websocket warning I’ll interpret them and tell you the exact next step. Sources: ElevenLabs TTS plugin guide | LiveKit Docs | ElevenLabs TTS | LiveKit Docs
Thanks — I see the curl failed because of a few syntax and field-name issues. Don’t share API keys in logs (mask them next time). Please run this corrected command (Windows cmd/powershell friendly) and paste the numeric HTTP status it returns: PowerShell (recommended):
Copy code
curl -s -o $null -w "%{http_code}`n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" `
  -H "xi-api-key: YOUR_KEY_HERE" `
  -H "Content-Type: application/json" `
  -d '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}'
Windows cmd:
Copy code
curl -s -o nul -w "%%{http_code}%%\n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" ^
  -H "xi-api-key: YOUR_KEY_HERE" ^
  -H "Content-Type: application/json" ^
  -d "{\"text\":\"مرحبا\",\"model_id\":\"eleven_multilingual_v2\"}"
What I need next: • The HTTP status code returned (e.g., 200, 401, 429). • If it’s not 200/201, paste the response body (remove or mask the API key). I’ll interpret the result and give the exact next step (auth/quota/voice compatibility).
l
Invoke-WebRequest : Missing an argument for parameter 'SessionVariable'. Specify a parameter of type 'System.String' and try again. At line:1 char:6 + curl -s -o $null -w "%{http_code}`n" -X POST "https://api.elevenlabs. ... + ~~ + CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException + FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
t
PowerShell maps curl to Invoke-WebRequest, which is why your previous command failed. Run one of these Windows-friendly tests and paste the numeric HTTP status (and response body if not 200/201). Option A — use curl.exe (Git for Windows / 64-bit curl):
Copy code
& curl.exe -s -o $null -w "%{http_code}`n" -X POST "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" `
  -H "xi-api-key: YOUR_KEY_HERE" `
  -H "Content-Type: application/json" `
  -d '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}'
Option B — use PowerShell built-in Invoke-RestMethod:
Copy code
$response = Invoke-RestMethod -Uri "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" `
  -Method POST `
  -Headers @{"xi-api-key"="YOUR_KEY_HERE"; "Content-Type"="application/json"} `
  -Body '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}' -ErrorAction Stop

$response | ConvertTo-Json
If Invoke-RestMethod throws an error, run this to capture status and body:
Copy code
try {
  Invoke-RestMethod -Uri "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" -Method POST -Headers @{"xi-api-key"="YOUR_KEY_HERE"; "Content-Type"="application/json"} -Body '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}' -ErrorAction Stop
  Write-Output "200"
} catch {
  $status = $_.Exception.Response.StatusCode.Value__
  $body = (New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())).ReadToEnd()
  Write-Output $status
  Write-Output $body
}
Mask your API key when pasting results. Send me the numeric HTTP status (and body if not 200/201) and I’ll tell you the exact next step.
I see PowerShell treated your curl as Invoke-WebRequest and the pasted key appeared in output — please regenerate your ElevenLabs API key now (rotate/revoke the exposed key) for security. After you rotate the key, run this PowerShell-safe test (replace NEW_KEY and mask it when sharing results). It returns the numeric HTTP status and response body on non-200:
Copy code
$headers = @{ "xi-api-key" = "NEW_KEY"; "Content-Type" = "application/json" }
$body = '{"text":"مرحبا","model_id":"eleven_multilingual_v2"}'
try {
  $resp = Invoke-RestMethod -Uri "https://api.elevenlabs.io/v1/text-to-speech/G1qujbcurbblbamyltgl" -Method POST -Headers $headers -Body $body -ErrorAction Stop
  Write-Output "200"
} catch {
  $r = $_.Exception.Response
  $status = $r.StatusCode.Value__
  $reader = New-Object System.IO.StreamReader($r.GetResponseStream())
  $respBody = $reader.ReadToEnd()
  Write-Output $status
  Write-Output $respBody
}
Share the numeric status (and response body if not 200). I’ll interpret it and give the exact next step (auth/quota/voice compatibility).
l
404
t
A 404 from the ElevenLabs synth endpoint means the voice ID or request path wasn't found — the API reached ElevenLabs but the voice_id you used isn't valid for that account or the endpoint path was incorrect. Please try these steps: 1) List available voices for your key (PowerShell):
Copy code
$h=@{"xi-api-key"="NEW_KEY"}
Invoke-RestMethod -Uri "https://api.elevenlabs.io/v1/voices" -Method GET -Headers $h | ConvertTo-Json
• Copy a returned
voice_id
from that response. 2) Test synth with a returned voice_id and multilingual model:
Copy code
$h=@{"xi-api-key"="NEW_KEY"; "Content-Type"="application/json"}
$body='{"text":"مرحبا","model_id":"eleven_multilingual_v2"}'
Invoke-RestMethod -Uri "https://api.elevenlabs.io/v1/text-to-speech/RETURNED_VOICE_ID" -Method POST -Headers $h -Body $body
• If you get 200/201 the voice works for Arabic. If 401/403 → auth; 429 → quota; 404 → voice not available to your key. 3) Update your LiveKit TTS config (v1.3.5) to use that valid voice_id and model:
Copy code
tts = elevenlabs.TTS(
    api_key=os.getenv("ELEVEN_API_KEY"),
    voice_id="RETURNED_VOICE_ID",
    model="eleven_multilingual_v2",
    language="ar",
    enable_ssml_parsing=False,
    apply_text_normalization="auto",
)
4) If synth still fails with websocket closes, capture the 8–12 log lines immediately before the websocket warning and paste them here, plus: • The HTTP status from the synth test above • The plugin version (you already shared 1.3.5 — keep that) If you want, paste the voices JSON here (mask the key) and I’ll point to an Arabic-capable voice to use.