Multi-Agent_AI_Health_System / test_openrouter.py
Noumankhan2005's picture
Initial commit: PRESAGE System with React frontend and FastAPI backend
19d6abb
raw
history blame contribute delete
720 Bytes
#!/usr/bin/env python3
"""
Quick test script to verify OpenRouter API connection
"""
import os
from dotenv import load_dotenv
from core.llm import ask_claude
load_dotenv()
# Verify environment variable is loaded
api_key = os.getenv("OPENROUTER_API_KEY")
print(f"API Key loaded: {api_key[:20]}..." if api_key else "ERROR: API Key not found")
# Test the API
try:
print("\nTesting OpenRouter API connection...")
response = ask_claude(
system_prompt="You are a helpful assistant. Respond briefly.",
user_message="Say 'Hello' and nothing else."
)
print(f"✓ Success! Response: {response}")
except Exception as e:
print(f"✗ Error: {e}")
import traceback
traceback.print_exc()