#!/usr/bin/env python3 """ Test both AI APIs separately to verify they work """ import asyncio import sys sys.path.append('/home/ren/musia') from src.backend.ai.ai_clients import GLM46Client, MinimaxM2Client async def test_glm46(): """Test GLM4.6 API via Z.AI""" print("\n" + "="*70) print("๐Ÿงช TEST 1: GLM4.6 API (Z.AI)") print("="*70) client = GLM46Client() # Verify config print(f"๐Ÿ“ก Endpoint: {client.base_url}") print(f"๐Ÿค– Model: {client.model}") print(f"๐Ÿ”‘ Token: {client.api_key[:30]}... (length: {len(client.api_key)})") # Test simple request print("\n๐Ÿ“ค Sending test request...") try: response = await client.complete( "Say exactly: 'GLM4.6 is working!'", max_tokens=50, temperature=0.1 ) print(f"\nโœ… GLM4.6 RESPONSE:") print(f" {response}") return True except Exception as e: print(f"\nโŒ GLM4.6 ERROR: {e}") return False async def test_minimax(): """Test Minimax M2 API""" print("\n" + "="*70) print("๐Ÿงช TEST 2: MINIMAX M2 API") print("="*70) client = MinimaxM2Client() # Verify config print(f"๐Ÿ“ก Endpoint: {client.base_url}") print(f"๐Ÿค– Model: {client.model}") print(f"๐Ÿ”‘ Token: {client.api_key[:30]}... (length: {len(client.api_key)})") # Test simple request print("\n๐Ÿ“ค Sending test request...") try: response = await client.complete( "Say exactly: 'Minimax M2 is working!'", max_tokens=50 ) print(f"\nโœ… MINIMAX M2 RESPONSE:") print(f" {response}") return True except Exception as e: print(f"\nโŒ MINIMAX M2 ERROR: {e}") return False async def main(): print("\n" + "๐ŸŽต"*35) print("MUSIAIA - API CONNECTIVITY TEST") print("๐ŸŽต"*35) glm_ok = False minimax_ok = False # Test GLM4.6 try: glm_ok = await test_glm46() except Exception as e: print(f"\nโŒ GLM4.6 Test crashed: {e}") # Test Minimax try: minimax_ok = await test_minimax() except Exception as e: print(f"\nโŒ Minimax Test crashed: {e}") # Summary print("\n" + "="*70) print("๐Ÿ“Š TEST SUMMARY") print("="*70) print(f"GLM4.6 (Z.AI): {'โœ… WORKING' if glm_ok else 'โŒ FAILED'}") print(f"Minimax M2: {'โœ… WORKING' if minimax_ok else 'โŒ FAILED'}") print("="*70) if glm_ok and minimax_ok: print("\n๐ŸŽ‰ ALL APIS ARE WORKING! Ready to generate music!") elif glm_ok or minimax_ok: print(f"\nโš ๏ธ {('GLM4.6' if glm_ok else 'Minimax M2')} is working. You can proceed.") else: print("\nโŒ No APIs are working. Check your credentials.") print() if __name__ == '__main__': asyncio.run(main())