# Test ElevenLabs API directly Write-Host "🧪 Testing ElevenLabs API Integration..." -ForegroundColor Yellow # Test 1: Check if your API is accessible try { Write-Host "`n1. Testing API health..." -ForegroundColor Cyan $health = Invoke-RestMethod -Uri "https://bravedims-ai-avatar-chat.hf.space/health" -Method GET Write-Host "✅ API Status: $($health.status)" -ForegroundColor Green Write-Host "✅ ElevenLabs Configured: $($health.elevenlabs_api_configured)" -ForegroundColor Green } catch { Write-Host "❌ API Health Check Failed: $($_.Exception.Message)" -ForegroundColor Red } # Test 2: Try a simple generate request with better voice ID try { Write-Host "`n2. Testing generation with Rachel voice (most reliable)..." -ForegroundColor Cyan $testPayload = @{ prompt = "A simple test" text_to_speech = "This is a test message." voice_id = "21m00Tcm4TlvDq8ikWAM" guidance_scale = 5.0 audio_scale = 3.5 num_steps = 20 } | ConvertTo-Json -Depth 3 Write-Host "Payload:" -ForegroundColor Gray Write-Host $testPayload -ForegroundColor White $headers = @{"Content-Type" = "application/json"} $response = Invoke-RestMethod -Uri "https://bravedims-ai-avatar-chat.hf.space/generate" -Method POST -Body $testPayload -Headers $headers -TimeoutSec 120 Write-Host "✅ Generation successful!" -ForegroundColor Green $response | ConvertTo-Json -Depth 3 } catch { Write-Host "❌ Generation failed: $($_.Exception.Message)" -ForegroundColor Red if ($_.Exception.Response) { Write-Host "Status Code: $($_.Exception.Response.StatusCode)" -ForegroundColor Yellow $reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream()) $responseBody = $reader.ReadToEnd() Write-Host "Response Body: $responseBody" -ForegroundColor Yellow } } Write-Host "`n📋 Common ElevenLabs Issues:" -ForegroundColor Magenta Write-Host "1. API Key expired or invalid" -ForegroundColor White Write-Host "2. Voice ID doesn't exist in your account" -ForegroundColor White Write-Host "3. Rate limit exceeded" -ForegroundColor White Write-Host "4. Account credit/quota exhausted" -ForegroundColor White