Im not able to configure custom base_url for 11Lab...
# ask-ai
b
Im not able to configure custom base_url for 11Labs - it keeps saying failing to synthesis speech. Any particular reason for this ?
t
Thanks for reaching out, Sathwik. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To configure a custom
base_url
for 11Labs, ensure you pass it as an argument when initializing the TTS client. For example:
Copy code
from livekit.plugins.elevenlabs import TTS

tts = TTS(
    api_key="your-api-key",  # Required
    base_url=BASE_API_URL,  # Custom base URL
)
Make sure the custom URL is properly formatted and compatible with the 11Labs API. If you encounter a failure in speech synthesis, here are some troubleshooting steps: • Verify your API key is valid and properly set. • Ensure the
base_url
is reachable and there are no network issues. • Check for timeouts and increase the timeout value if needed. • Ensure the audio format is compatible with your system. • Enable logging to debug API requests and responses. If the issue persists, let me know the specific error message or behavior you're encountering, and I can assist further.
b
yes im doing the same. tts=elevenlabs.TTS( model="eleven_turbo_v2_5", voice_id=eleven_voice_id, api_key=elevenlabs_api_key, base_url=eleven_base_url ),
Copy code
the error goes as - File "C:\Users\Sathw\Desktop\office-work\EmmaLiveKit\.venv\Lib\site-packages\livekit\plugins\elevenlabs\tts.py", line 355, in _run
    raise APIStatusError(
        message=e.message, status_code=e.status, request_id=request_id, body=None
    ) from None
livekit.agents._exceptions.APIStatusError: Invalid response status (status_code=403, request_id=2537f6bc2500, body=None, retryable=False)
2025-08-05 02:39:36,229 - WARNING livekit.agents - failed to synthesize speech, retrying in 0.1s {"tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 1, "streamed": true}
Traceback (most recent call last):
  File "C:\Users\Sathw\Desktop\office-work\EmmaLiveKit\.venv\Lib\site-packages\livekit\agents\tts\tts.py", line 348, in _main_task
    await self._run(output_emitter)
  File "C:\Users\Sathw\Desktop\office-work\EmmaLiveKit\.venv\Lib\site-packages\livekit\plugins\elevenlabs\tts.py", line 355, in _run
    raise APIStatusError(
        message=e.message, status_code=e.status, request_id=request_id, body=None
    ) from None
livekit.agents._exceptions.APIStatusError: Invalid response status (status_code=403, request_id=2537f6bc2500, body=None, retryable=False)
t
Hey there! The error
APIStatusError
with
status_code=403
usually means there’s an authorization hiccup with your request. No worries though—here’s how we can sort it out together: • Verify API Key: Make sure your 11Labs API key is valid, properly formatted, and has the right permissions. You can include it directly in your code or set it through the
ELEVEN_API_KEY
environment variable. • Check Network Connectivity: Double-check that your app can reach the
base_url
endpoint and that nothing like a firewall or proxy is blocking the request. • Monitor API Usage: Keep an eye on your API usage to ensure you haven’t hit any limits or quotas set by 11Labs. • Inspect Logs: Take a peek at the logs for any extra error details that might give us more clues. If you’re still running into trouble, just double-check the API key and permissions, and feel free to reach out—I’m here to help!
b
its an enterprise account do u think we need permission ?
t
Hey there! Even if you have an enterprise account, some API keys might still need the right permissions to access certain features or endpoints. It’s a good idea to double-check that the API key you’re using has the permissions needed for the custom
base_url
and the specific TTS model you want to work with. If you’re sure the API key is valid and the permissions look good, the hiccup might be with the custom
base_url
. Make sure that the custom endpoint is fully compatible with the 11Labs API and set up correctly to handle requests. Feel free to reach out if you want a hand verifying the API key permissions or testing the custom
base_url
. I’m here to help!