#!/usr/bin/env bash # litellm/verify_failover.sh - 验证主副 key 都工作 set -euo pipefail LITELLM_URL="http://localhost:12900" MASTER_KEY="sk-litellm-master-key-aiflow-2026" MODEL="deepseek-ai/DeepSeek-V4-Flash" echo "=== 1. health ===" curl -s -o /dev/null -w "%{http_code}\n" $LITELLM_URL/health/liveliness echo "=== 2. test primary key (should work) ===" curl -s -X POST $LITELLM_URL/v1/chat/completions \ -H "Authorization: Bearer $MASTER_KEY" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"say hi\"}],\"max_tokens\":5}" \ | head -c 200 echo "" echo "=== 3. check /metrics for failover count ===" curl -s $LITELLM_URL/metrics | grep -E "litellm_deployment_fail" | head -3 || echo " (no fail metric yet)"