2.4 KiB
2.4 KiB
AI/LiteLLM Debugging Guide
Debugging AI Integration Issues
Problem: "Invalid model name" error
{"error":{"message":"/chat/completions: Invalid model name passed in model=gpt-4o-mini.
Call `/v1/models` to view available models for your key.","type":"None","param":"None","code":"400"}}
Debugging Steps:
- Check available models:
curl -s "https://YOUR_LITELLM_URL/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"
- Use correct model name from response - model names like
minimax-2.7, nottiger-minimaxetc.
Problem: "login fail" error
{"base_resp":{"status_code":1004,"status_msg":"login fail: Please carry the API secret key
in the 'Authorization' field of the request header"}}
Causes:
- Wrong API key format
- Invalid API key
- Key not configured in LiteLLM
Debugging Steps:
- Test API key directly:
curl -s -X POST "https://api.minimax.chat/v1/text/chatcompletion_v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_KEY" \
-d '{"model":"abab7.5-chat","messages":[{"role":"user","content":"hi"}]}'
Problem: Empty response
Error:
{"reply":"Sorry, I couldn't get a response."}
Debugging Steps:
- Add debug logging:
const data = await response.json();
console.log("API response:", data);
return NextResponse.json({ reply: data.choices?.[0]?.message?.content });
- Check server health:
curl -s "https://YOUR_LITELLM_URL/health"
Problem: Network errors (fetch failed)
Debug:
- Check URL accessibility from deployed server
- Use full domain, not internal hostname:
https://llm.manohargupta.comnothttp://litellm-gateway:4000 - Add
https://prefix
LiteLLM URL Pattern
https://llm.manohargupta.com/v1/chat/completions
Expected models from LiteLLM:
minimax-2.7minimax-2.7-fastclaude-haikuclaude-sonnetnvidia-llama
API Key Format
For LiteLLM:
- Key:
sk-tiger-gateway-...(your key) - Header:
Authorization: Bearer sk-tiger-gateway-...
For MiniMax direct:
- Different key format - check platform.minimax.ai
Test Script
# Test LiteLLM
curl -s -X POST "https://llm.manohargupta.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-tiger-gateway-YOUR_KEY" \
-d '{"model":"minimax-2.7","messages":[{"role":"user","content":"hi"}]}'