INNER CODE UNIT · Python
display_elevenlabs_quota
bigsk1/voice-chat-ai · app/app.py:318
def display_elevenlabs_quota():
try:
response = requests.get(
"https://api.elevenlabs.io/v1/user",
headers={"xi-api-key": ELEVENLABS_API_KEY},
timeout=30
)
response.raise_for_status()
user_data = response.json()
character_count = user_data['subscription']['character_count']
character_limit = user_data['subscription']['character_limit']
print(f"{NEON_GREEN}ElevenLabs Character Usage: {character_count} / {character_limit}{RESET_COLOR}")
except Exception as e:
print(f"{YELLOW}Could not fetch ElevenLabs quota: {e}{RESET_COLOR}")
if TTS_PROVIDER == "elevenlabs":
display_elevenlabs_quota()