Summary
Add support for multiple AI models beyond Gemini (e.g., DeepSeek, Kimi) to provide diverse buy/sell suggestions and automatic fallback when the primary model is unavailable.
Motivation
Currently, Richfolio relies solely on Google Gemini for AI-powered analysis. This creates two problems:
- Single point of failure — If Gemini hits quota limits, has an outage, or the API key isn't activated yet, AI analysis falls back to basic gap-based recommendations with no AI insight at all.
- Single perspective — Different AI models have different training data and reasoning patterns. Getting recommendations from multiple models would provide more balanced, diversified investment signals.
Proposed Feature
Multi-model analysis
- Configure 2+ AI providers (e.g., Gemini, DeepSeek, Kimi)
- Each model independently analyzes the portfolio and produces buy/sell recommendations
- Results are presented side-by-side in the email/Telegram digest so the user can compare perspectives
- Optionally, a consensus view (e.g., "2 of 3 models say STRONG BUY") could be shown
Automatic fallback chain
- Define a priority order of models (e.g., Gemini → DeepSeek → Kimi)
- If the primary model fails (quota, timeout, error), automatically try the next model in the chain
- Graceful degradation: always attempt AI analysis before falling back to gap-based recommendations
Configuration
Environment Variables
GEMINI_API_KEY (existing)
DEEPSEEK_API_KEY (new)
KIMI_API_KEY (new)
All optional — only configured models are used.
Considerations
- Keep each provider as a separate module (e.g.,
src/ai/gemini.ts, src/ai/deepseek.ts) behind a common interface
- Free tier limits vary by provider — document quota expectations
- Multi-model mode will increase execution time (parallel calls can mitigate this)
- Email/Telegram templates need layout updates to show multi-model results
Summary
Add support for multiple AI models beyond Gemini (e.g., DeepSeek, Kimi) to provide diverse buy/sell suggestions and automatic fallback when the primary model is unavailable.
Motivation
Currently, Richfolio relies solely on Google Gemini for AI-powered analysis. This creates two problems:
Proposed Feature
Multi-model analysis
Automatic fallback chain
Configuration
Environment Variables
GEMINI_API_KEY(existing)DEEPSEEK_API_KEY(new)KIMI_API_KEY(new)All optional — only configured models are used.
Considerations
src/ai/gemini.ts,src/ai/deepseek.ts) behind a common interface