Skip to content

Support multiple AI models (DeepSeek, Kimi) for diverse suggestions and fallback #3

@furic

Description

@furic

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:

  1. 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.
  2. 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

// config.json
{
  "aiModels": [
    { "provider": "gemini", "model": "gemini-2.5-flash" },
    { "provider": "deepseek", "model": "deepseek-chat" },
    { "provider": "kimi", "model": "moonshot-v1-8k" }
  ],
  "aiMode": "multi"  // "multi" = all models, "fallback" = try in order until one succeeds
}

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfuture-featureFeatures to evaluate or implement later

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions