#!/bin/bash echo "Testing local backend connection..." echo "" # Test /ping endpoint echo "1. Testing health check..." PING_RESPONSE=$(curl -s http://localhost:8080/ping 2>&1) if [ "$PING_RESPONSE" = "pong" ]; then echo " ✅ Health check passed" else echo " ❌ Health check failed" echo " Response: $PING_RESPONSE" echo "" echo "Is the proxy running? Check: ps aux | grep claude-proxy" exit 1 fi # Test /v1/messages endpoint echo "2. Testing inference..." RESPONSE=$(curl -s -X POST http://localhost:8080/v1/messages \ -H "Content-Type: application/json" \ -d '{"messages":[{"role":"user","content":"Reply with exactly: Test successful"}]}' 2>&1) echo " Response: $RESPONSE" if echo "$RESPONSE" | grep -q "choices"; then echo " ✅ Inference endpoint working" echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "✅ Local Backend is working correctly!" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" else echo " ❌ Inference test failed" echo "" echo "Troubleshooting:" echo " 1. Check Claude CLI: echo 'test' | claude" echo " 2. Check logs: tail -f proxy.log" echo " 3. Restart proxy: ./stop-proxy.sh && ./start-proxy.sh" exit 1 fi