I'm trying to run the example code provided in the readme and I'm getting this error:
401 Client Error: Unauthorized for url: https://api.elevenlabs.io/v1/voices
File "C:\Users\jarod\Desktop\Code\Vivy\Test.py", line 11, in <module>
voice = user.get_voices_by_name("Rachel")[0] # This is a list because multiple voices can have the same name
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.elevenlabs.io/v1/voices
The code is simply:
import io
import json
import os
import elevenlabslib.helpers
from elevenlabslib import *
user = ElevenLabsUser("[my api key]")
voice = user.get_voices_by_name("Rachel")[0] # This is a list because multiple voices can have the same name
voice.play_preview(playInBackground=False)
for sample in voice.get_samples():
sample.play_audio(playInBackground=False)
voice.generate_and_play_audio("Test.", playInBackground=False)
for historyItem in user.get_history_items():
if historyItem.text == "Test.":
# The first items are the newest, so we can stop as soon as we find one.
historyItem.delete()
break
I don't have much experience working with Python and API's so I'm not sure why this error is occuring, I've tried to use a new API key, clear browser cookies, and log back in/out.
I'm trying to run the example code provided in the readme and I'm getting this error:
The code is simply:
I don't have much experience working with Python and API's so I'm not sure why this error is occuring, I've tried to use a new API key, clear browser cookies, and log back in/out.