hi team, I am using eleven labs tts for agent con...
# ask-ai
b
hi team, I am using eleven labs tts for agent config:
Copy code
tts=elevenlabs.TTS(voice_id=eleven_voice_id,model="eleven_turbo_v2_5",api_key=elevenlabs_api_key,base_url=eleven_base_url),
I am using enterprise creds which are a bit different than normal, I laso have a different base url and have set them up as per docs of agents 1.2.2. I am getting 403 awith unable to push audio frames error. Whats wierd if i switch back to normal ones it works. I tried to test using elevenlabs library and a dummy text and was able to receive audio. Any idea how this can be resolved or where I need to look?
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.
The 403 error you're encountering when using Eleven Labs TTS with enterprise credentials may be due to authentication or configuration issues. Here are steps to resolve this: • Verify API Key: Ensure the API key is correct, active, and has the necessary permissions. You can test it directly using the Eleven Labs library or an HTTP request. • Check Base URL: Confirm that the custom base URL is accurate and matches your enterprise setup. • Voice ID and Model: Ensure the voice ID and model are valid for your account. You can list available voices using the Eleven Labs library to verify. • Network Configuration: Ensure your network allows outbound HTTPS connections to the Eleven Labs API endpoint. • Enable Logging: Add detailed logging to capture the exact error details for further debugging. If these steps don't resolve the issue, let me know, and we can explore further options. Sources: ElevenLabs TTS integration guide | LiveKit Docs | livekit-agents/livekit/agents/voice/agent.py
b
How to verify the key using http ??
t
Hey there! You can easily check if your API key is working by sending a quick HTTP request to the Eleven Labs API. Here’s a friendly little example in Python to get you started:
Copy code
import aiohttp
import asyncio

async def test_api_key():
    async with aiohttp.ClientSession() as session:
        async with session.get(
            "<https://api.elevenlabs.io/v1/voices>",
            headers={"xi-api-key": "your_api_key_here"}
        ) as resp:
            print(f"Status: {resp.status}")
            if resp.status != 200:
                print(f"Error: {await resp.text()}")

asyncio.run(test_api_key())
Just swap out
your_api_key_here
with your actual API key. If everything’s good, you’ll get a status of 200 and a list of voices you can use. If not, don’t worry—an error message will help you figure out what’s up.
b
But it’s a EU account
t
Hey there! If your account is based in the EU, you’ll want to make sure you’re using the right base URL for the Eleven Labs API. Just update your HTTP request to point to the EU-specific endpoint like this:
Copy code
import aiohttp
import asyncio

async def test_api_key():
    async with aiohttp.ClientSession() as session:
        async with session.get(
            f"{BASE_API_URL}/v1/voices",
            headers={"xi-api-key": "your_api_key_here"}
        ) as resp:
            print(f"Status: {resp.status}")
            if resp.status != 200:
                print(f"Error: {await resp.text()}")

asyncio.run(test_api_key())
Just swap out
BASE_API_URL
with your EU-specific base URL and pop in your real API key where it says
your_api_key_here
. This way, your request will go straight to the right regional endpoint for your EU account. If you hit any bumps, I’m here to help!